Skip to content
Back to Blog
1 min read

Tabular Editor for Power BI: Advanced Dataset Development

I wrote “Tabular Editor for Power BI: Advanced Dataset Development” to share practical, production-minded guidance on this topic.

Why Tabular Editor

advantages:
  - Edit multiple measures simultaneously
  - Better DAX editing experience
  - No data loading required
  - Faster for large models
  - Script automation support
  - Best Practice Analyzer

Installation

# Tabular Editor 2 (Free)
# Download from: https://github.com/TabularEditor/TabularEditor/releases

# Tabular Editor 3 (Commercial)
# Download from: https://tabulareditor.com/

Connecting to Power BI

connection_options:
  # From PBIX file
  file: Open saved PBIX file

  # From Power BI Service (XMLA)
  xmla: powerbi://api.powerbi.com/v1.0/myorg/WorkspaceName

  # From local Analysis Services
  server: localhost:portnumber

DAX Authoring

Batch Measure Creation

// C# Script in Tabular Editor
foreach(var t in Model.Tables.Where(t => t.Columns.Any(c => c.Name == "Amount")))
{
    t.AddMeasure(
        "Total " + t.Name,
        "SUM(" + t.DaxObjectFullName + "[Amount])",
        "Calculated Measures"
    );
}

Format All Measures

// Format all measures using DAX Formatter
foreach(var m in Model.AllMeasures)
{
    m.FormatDax();
}

Best Practice Analyzer

// Custom BPA rules
{
  "rules": [
    {
      "id": "AVOID_INACTIVE_RELATIONSHIPS",
      "name": "Avoid inactive relationships",
      "category": "Performance",
      "description": "Inactive relationships should be reviewed",
      "severity": 2,
      "scope": "relationship",
      "expression": "IsActive == false"
    },
    {
      "id": "NO_DESCRIPTION",
      "name": "Measures should have descriptions",
      "category": "Documentation",
      "description": "All measures should be documented",
      "severity": 1,
      "scope": "measure",
      "expression": "string.IsNullOrEmpty(Description)"
    }
  ]
}

Deployment Automation

# Deploy via command line
TabularEditor.exe model.bim -D "powerbi://api.powerbi.com/v1.0/myorg/Workspace" DatasetName -O -R

# Parameters:
# -D: Deploy
# -O: Overwrite
# -R: Replace connections

C# Scripting Examples

Create Calculation Groups

var cg = Model.AddCalculationGroup("Time Intelligence");
cg.AddCalculationItem("YTD", "CALCULATE(SELECTEDMEASURE(), DATESYTD('Date'[Date]))");
cg.AddCalculationItem("PY", "CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))");
cg.AddCalculationItem("YoY", "DIVIDE(SELECTEDMEASURE() - [PY], [PY])");

Generate Documentation

var sb = new System.Text.StringBuilder();
sb.AppendLine("# Model Documentation");

foreach(var t in Model.Tables)
{
    sb.AppendLine($"## {t.Name}");
    foreach(var m in t.Measures)
    {
        sb.AppendLine($"### {m.Name}");
        sb.AppendLine($"```dax\n{m.Expression}\n```");
    }
}

SaveFile("documentation.md", sb.ToString());

Best Practices

workflow:
  - Use source control for model files
  - Run BPA before deployment
  - Document all measures
  - Test changes before production

organization:
  - Use display folders
  - Consistent naming conventions
  - Hide technical columns
  - Add descriptions

Conclusion

Tabular Editor transforms Power BI development:

  • Faster editing for large models
  • Automation capabilities
  • Better governance through BPA
  • Professional development workflow

Resources

Michael John Peña

Michael John Peña

Senior Data Engineer based in Sydney. Writing about data, cloud, and technology.