Index of every page on this site: llms.txt
All skills
github avatar

/powerbi-modeling

@f10fdb8 official
by githubgithub/awesome-copilot42k stars
5,426
Run it yourself

Power BI semantic modeling assistant for building optimized data models. Use when working with Power BI semantic models, creating measures, designing star schemas, configuring relationships, implementing RLS, or optimizing model performance. Triggers on queries about DAX calculations, table relationships, dimension/fact table design, naming conventions, model documentation, cardinality, cross-filter direction, calculation groups, and data model best practices. Always connects to the active model first using power-bi-modeling MCP tools to understand the data structure before providing guidance.

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/powerbi-modeling

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesPERFORMANCE.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Performance Optimization for Power BI Models

Data Reduction Techniques

1. Remove Unnecessary Columns

  • Only import columns needed for reporting
  • Remove audit columns (CreatedBy, ModifiedDate) unless required
  • Remove duplicate/redundant columns
column_operations(operation: "List", filter: { tableNames: ["Sales"] })
// Review and remove unneeded columns

2. Remove Unnecessary Rows

  • Filter historical data to relevant period
  • Exclude cancelled/void transactions if not needed
  • Apply filters in Power Query (not in DAX)

3. Reduce Cardinality

High cardinality (many unique values) impacts:

  • Model size
  • Refresh time
  • Query performance

Solutions:

Column Type Reduction Technique
DateTime Split into Date and Time columns
Decimal precision Round to needed precision
Text with patterns Extract common prefix/suffix
High-precision IDs Use surrogate integer keys

4. Optimize Data Types

From To Benefit
DateTime Date (if time not needed) 8 bytes to 4 bytes
Decimal Fixed Decimal Better compression
Text with numbers Whole Number Much better compression
Long text Shorter text Reduces storage

5. Group and Summarize

Pre-aggregate data when detail not needed:

  • Daily instead of transactional
  • Monthly instead of daily
  • Consider aggregation tables for DirectQuery

Column Optimization

Prefer Power Query Columns Over Calculated Columns

Approach When to Use
Power Query (M) Can be computed at source, static values
Calculated Column (DAX) Needs model relationships, dynamic logic

Power Query columns:

  • Load faster
  • Compress better
  • Use less memory

Avoid Calculated Columns on Relationship Keys

DAX calculated columns in relationships:

  • Cannot use indexes
  • Generate complex SQL for DirectQuery
  • Hurt performance significantly

Use COMBINEVALUES for multi-column relationships:

// If you must use calculated column for composite key
CompositeKey = COMBINEVALUES(",", [Country], [City])

Set Appropriate Summarization

Prevent accidental aggregation of non-additive columns:

column_operations(
  operation: "Update",
  definitions: [{
    tableName: "Product",
    name: "UnitPrice",
    summarizeBy: "None"
  }]
)

Relationship Optimization

1. Minimize Bidirectional Relationships

Each bidirectional relationship:

  • Increases query complexity
  • Can create ambiguous paths
  • Reduces performance

2. Avoid Many-to-Many When Possible

Many-to-many relationships:

  • Generate more complex queries
  • Require more memory
  • Can produce unexpected results

3. Reduce Relationship Cardinality

Keep relationship columns low cardinality:

  • Use integer keys over text
  • Consider higher-grain relationships

DAX Optimization

1. Use Variables

// GOOD - Calculate once, use twice
Sales Growth = 
VAR CurrentSales = [Total Sales]
VAR PriorSales = [PY Sales]
RETURN DIVIDE(CurrentSales - PriorSales, PriorSales)

// BAD - Recalculates [Total Sales] and [PY Sales]
Sales Growth = 
DIVIDE([Total Sales] - [PY Sales], [PY Sales])

2. Avoid FILTER with Entire Tables

// BAD - Iterates entire table
Sales High Value = 
CALCULATE([Total Sales], FILTER(Sales, Sales[Amount] > 1000))

// GOOD - Uses column reference
Sales High Value = 
CALCULATE([Total Sales], Sales[Amount] > 1000)

3. Use KEEPFILTERS Appropriately

// Respects existing filters
Sales with Filter = 
CALCULATE([Total Sales], KEEPFILTERS(Product[Category] = "Bikes"))

4. Prefer DIVIDE Over Division Operator

// GOOD - Handles divide by zero
Margin % = DIVIDE([Profit], [Sales])

// BAD - Errors on zero
Margin % = [Profit] / [Sales]

DirectQuery Optimization

1. Minimize Columns and Tables

DirectQuery models:

  • Query source for every visual
  • Performance depends on source
  • Minimize data retrieved

2. Avoid Complex Power Query Transformations

  • Transforms become subqueries
  • Native queries are faster
  • Materialize at source when possible

3. Keep Measures Simple Initially

Complex DAX generates complex SQL:

  • Start with basic aggregations
  • Add complexity gradually
  • Monitor query performance

4. Disable Auto Date/Time

For DirectQuery models, disable auto date/time:

  • Creates hidden calculated tables
  • Increases model complexity
  • Use explicit date table instead

Aggregations

User-Defined Aggregations

Pre-aggregate fact tables for:

  • Very large models (billions of rows)
  • Hybrid DirectQuery/Import
  • Common query patterns
table_operations(
  operation: "Create",
  definitions: [{
    name: "SalesAgg",
    mode: "Import",
    mExpression: "..."
  }]
)

Performance Testing

Use Performance Analyzer

  1. Enable in Power BI Desktop
  2. Start recording
  3. Interact with visuals
  4. Review DAX query times

Monitor with DAX Studio

External tool for:

  • Query timing
  • Server timings
  • Query plans

Validation Checklist

  • Unnecessary columns removed
  • Appropriate data types used
  • High-cardinality columns addressed
  • Bidirectional relationships minimized
  • DAX uses variables for repeated expressions
  • No FILTER on entire tables
  • DIVIDE used instead of division operator
  • Auto date/time disabled for DirectQuery
  • Performance tested with representative data

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill facilitates Power BI semantic modeling by connecting to active models and applying Microsoft best practices. It includes a potential attack surface for indirect prompt injection because it ingests metadata and data from Power BI models, though no malicious behavior or safety bypasses were detected.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

  • Runlayer9mo

    5/6 files flagged

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at f10fdb8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 10 months ago
  • power-bi
  • dax
  • semantic-modeling
  • star-schema
  • relationships
  • rls
  • measures
  • performance-tuning
  • data-modeling

README badge

README badge for github/awesome-copilot/powerbi-modeling

Assists with building and optimizing Power BI semantic models by analyzing the active model and providing guidance on star schemas, DAX measures, relationships, RLS, and performance tuning. Connects to Power BI Desktop or Fabric via MCP tools to inspect table structure, relationships, and measures before recommending improvements aligned with Microsoft best practices.

Generated from the current SKILL.md.

Does this skill work with Power BI Desktop and Fabric semantic models?
Yes. The skill connects to both Power BI Desktop instances and Fabric models via the Power BI Modeling MCP Server using connection_operations with ConnectFabric support.
What do I need to set up before using this skill?
The Power BI Modeling MCP Server must be configured and running. The Microsoft Learn MCP Server is optional but recommended for researching latest best practices and DAX documentation.
Can this skill write DAX measures and create relationships in my model?
Yes. The skill can create measures with measure_operations, create relationships with relationship_operations, update column metadata, and modify model structure via the bundled MCP tools.
Does this skill help with row-level security (RLS)?
Yes. The skill provides guidance on implementing RLS and can interact with security roles via security_role_operations to list, create, and update role definitions.
What happens if I ask about a modeling scenario the skill doesn't recognize?
The skill will first connect to your model to analyze the current state, then provide targeted guidance based on Power BI best practices and Microsoft Learn documentation if needed.

Generated from the current SKILL.md. These answers refresh after source changes.