Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions content/kb/bpa-avoid-invalid-characters-descriptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
uid: kb.bpa-avoid-invalid-characters-descriptions
title: Avoid Invalid Characters in Descriptions
author: Morten Lønskov
updated: 2026-01-09
description: Best practice rule preventing display and deployment issues by identifying control characters in object descriptions.
---

# Avoid Invalid Characters in Descriptions

## Overview

This best practice rule identifies objects whose descriptions contain invalid control characters (non-printable characters excluding standard whitespace). These characters can cause display problems, metadata corruption, and deployment failures.

- Category: Error Prevention
- Severity: High (3)

## Applies To

- Tables
- Measures
- Hierarchies
- Levels
- Perspectives
- Partitions
- Data Columns
- Calculated Columns
- Calculated Table Columns
- KPIs
- Model Roles
- Calculation Groups
- Calculation Items

## Why This Matters

Control characters in descriptions cause various issues:

- **Display corruption**: Tooltips and documentation panels may show garbled text
- **Metadata problems**: TMSL/XMLA export may produce invalid XML
- **Deployment failures**: Power BI Service or Analysis Services may reject the model
- **Documentation issues**: Generated documentation may break formatting
- **Encoding errors**: Cross-platform synchronization problems
- **User confusion**: Invisible characters create confusing or corrupted descriptions

Standard whitespace (spaces, newlines, tabs) is acceptable, but non-printable control characters should be removed.

## When This Rule Triggers

The rule triggers when an object's description contains control characters that are not standard whitespace:

```csharp
Description.ToCharArray().Any(char.IsControl(it) and !char.IsWhiteSpace(it))
```

This detects problematic characters while allowing legitimate whitespace formatting.

## How to Fix

### Automatic Fix

This rule includes an automatic fix that replaces invalid characters with spaces:

```csharp
Description = string.Concat(
it.Description.ToCharArray().Select(
c => (char.IsControl(c) && !char.IsWhiteSpace(c)) ? ' ' : c
)
)
```

To apply:
1. In the **Best Practice Analyzer** select flagged objects
3. Click **Apply Fix**

### Manual Fix

1. In **TOM Explorer**, select the object
2. In **Properties** pane, locate the **Description** field
3. Edit the description to remove invalid characters
4. Save changes

## Common Causes

### Cause 1: Copy/Paste from Rich Text

Copying descriptions from Word documents, web pages, or emails can introduce hidden formatting characters.

### Cause 2: Automated Documentation Generation

Scripts generating descriptions may include control characters from source systems.

### Cause 3: Data Import from External Sources

Importing metadata that contains encoding artifacts or control codes.

## Example

### Before Fix

```
Measure: [Total Revenue]
Description: "Calculates\x00total\x0Brevenue" (contains NULL and vertical tab)
```

Tooltip displays: "Calculates□total□revenue" (with visible corruption)

### After Fix

```
Measure: [Total Revenue]
Description: "Calculates total revenue" (control characters replaced with spaces)
```

Tooltip displays correctly: "Calculates total revenue"

## Compatibility Level

This rule applies to models with compatibility level **1200** and higher.

## Related Rules

- [Avoid Invalid Characters in Names](xref:kb.bpa-avoid-invalid-characters-names) - Similar validation for object names
- [Visible Objects Should Have Descriptions](xref:kb.bpa-visible-objects-no-description) - Ensuring descriptions exist
125 changes: 125 additions & 0 deletions content/kb/bpa-avoid-invalid-characters-names.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
uid: kb.bpa-avoid-invalid-characters-names
title: Avoid Invalid Characters in Object Names
author: Morten Lønskov
updated: 2026-01-09
description: Best practice rule preventing deployment errors by identifying control characters in object names.
---

# Avoid Invalid Characters in Object Names

## Overview

This best practice rule identifies objects whose names contain invalid control characters (non-printable characters excluding standard whitespace). These characters can cause deployment failures, rendering issues, and data corruption.

- Category: Error Prevention
- Severity: High (3)

## Applies To

- Tables
- Measures
- Hierarchies
- Levels
- Perspectives
- Partitions
- Data Columns
- Calculated Columns
- Calculated Table Columns
- KPIs
- Model Roles
- Calculation Groups
- Calculation Items

## Why This Matters

Control characters in object names cause serious issues:

- **Deployment failures**: Power BI Service and Analysis Services may reject models with invalid characters
- **Rendering problems**: Client tools may display garbled or invisible names
- **DAX parsing errors**: Invalid characters can break DAX expressions referencing the object
- **XML corruption**: Model metadata (TMSL/XMLA) may become malformed
- **Copy/paste issues**: Names may not transfer correctly between applications
- **Encoding problems**: Cross-platform compatibility issues

Standard whitespace (spaces, newlines, carriage returns) is allowed, but control characters should be removed.

## When This Rule Triggers

The rule triggers when an object's name contains control characters that are not standard whitespace:

```csharp
Name.ToCharArray().Any(char.IsControl(it) and !char.IsWhiteSpace(it))
```

This detects problematic characters while allowing legitimate whitespace formatting.

## How to Fix

### Automatic Fix

This rule includes an automatic fix that replaces invalid characters with spaces:

```csharp
Name = string.Concat(
it.Name.ToCharArray().Select(
c => (char.IsControl(c) && !char.IsWhiteSpace(c)) ? ' ' : c
)
)
```

To apply:
1. In the **Best Practice Analyzer** select flagged objects
2. Click **Apply Fix**

### Manual Fix

1. In **TOM Explorer**, select the object
2. In **Properties** pane, locate the **Name** field
3. Edit the name to remove invalid characters
4. Save changes

## Common Causes

### Cause 1: Copy/Paste from Rich Text

Copying names from Word documents, web pages, or emails can introduce hidden formatting characters.

### Cause 2: Automated Name Generation

Scripts generating names may include control characters from source systems.

### Cause 3: Data Import from External Sources

Importing metadata that contains encoding artifacts or control codes.

## Example

### Before Fix

```
Measure Name: "Total\x00Sales" (contains NULL character)
```

Deployment fails with "Invalid character in object name"

### After Fix

```
Measure Name: "Total Sales" (NULL replaced with space)
```

Deploys successfully and displays correctly in all tools.

## Compatibility Level

This rule applies to models with compatibility level **1200** and higher.

## Related Rules

- [Avoid Invalid Characters in Descriptions](xref:kb.bpa-avoid-invalid-characters-descriptions) - Similar validation for description properties
- [Trim Object Names](xref:kb.bpa-trim-object-names) - Removing leading/trailing spaces

## Learn More

- [DAX Naming Rules](https://learn.microsoft.com/dax/dax-syntax-reference)
96 changes: 96 additions & 0 deletions content/kb/bpa-avoid-provider-partitions-structured.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
uid: kb.bpa-avoid-provider-partitions-structured
title: Avoid Provider Partitions with Structured Data Sources
author: Morten Lønskov
updated: 2026-01-09
description: Best practice rule preventing deployment errors by identifying legacy provider partitions used with structured data sources in Power BI.
---

# Avoid Provider Partitions with Structured Data Sources

## Overview

This best practice rule identifies partitions that use legacy provider-based queries (SourceType = Query) with structured data sources in Power BI models. This combination is not supported in Power BI Service and will cause deployment failures.

- Category: Error Prevention

- Severity: Medium (2)

## Applies To

- Partitions

## Why This Matters

Power BI Service requires structured data sources to use Power Query (M) partitions rather than legacy provider partitions. Using provider partitions with structured data sources causes:

- **Deployment failures**: Models fail to publish to Power BI Service
- **Refresh errors**: Scheduled refresh operations fail in the service
- **Compatibility issues**: The model cannot be shared or deployed properly
- **Migration blockers**: Prevents moving from Analysis Services to Power BI

## When This Rule Triggers

The rule triggers when a partition meets all these conditions:

1. `SourceType = "Query"` (legacy provider partition)
2. `DataSource.Type = "Structured"` (Power Query/M data source)
3. `Model.Database.CompatibilityMode != "AnalysisServices"` (Power BI or Azure AS)

This combination indicates a structural mismatch that Power BI cannot process.

## How to Fix

### Manual Fix

1. In **TOM Explorer**, select the affected partition
2. In **Properties** pane, note the existing query
3. Create a new **Power Query** partition with M expression
4. Delete the old provider partition after verifying the new one works

## Common Causes

### Cause 1: Migration from Analysis Services

Models migrated from SQL Server Analysis Services retain legacy provider partitions.

### Cause 2: Mixed Partition Types

Mixing partition types during model development creates incompatible configurations.

## Example

### Before Fix

```
Partition: Sales_Partition
SourceType: Query
Query: SELECT * FROM Sales
DataSource: PowerQuerySource (Type: Structured)
```

**Error**: Deployment fails to Power BI Service

### After Fix

```
Partition: Sales_Partition
SourceType: M
Expression:
let
Source = Sql.Database("server", "database"),
Sales = Source{[Schema="dbo",Item="Sales"]}[Data]
in
Sales
DataSource: PowerQuerySource (Type: Structured)
```

**Result**: Deploys successfully to Power BI Service

## Compatibility Level

This rule applies to models with compatibility level **1200** and higher when deployed to Power BI or Azure Analysis Services.

## Related Rules

- [Data Column Must Have Source](xref:kb.bpa-data-column-source) - Ensuring column source mappings
Loading