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.

referencesRLS.md

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

Row-Level Security (RLS) in Power BI

Overview

Row-Level Security restricts data access at the row level based on user identity. Users see only the data they're authorized to view.

Design Principles

1. Filter on Dimension Tables

Apply RLS to dimensions, not fact tables:

  • More efficient (smaller tables)
  • Filters propagate through relationships
  • Easier to maintain
// On Customer dimension - filters propagate to Sales
[Region] = "West"

2. Create Minimal Roles

Avoid many role combinations:

  • Each role = separate cache
  • Roles are additive (union, not intersection)
  • Consolidate where possible

3. Use Dynamic RLS When Possible

Data-driven rules scale better:

  • User mapping in a table
  • USERPRINCIPALNAME() for identity
  • No role changes when users change

Static vs Dynamic RLS

Static RLS

Fixed rules per role:

// Role: West Region
[Region] = "West"

// Role: East Region  
[Region] = "East"

Pros: Simple, clear Cons: Doesn't scale, requires role per group

Dynamic RLS

User identity drives filtering:

// Single role filters based on logged-in user
[ManagerEmail] = USERPRINCIPALNAME()

Pros: Scales, self-maintaining Cons: Requires user mapping data

Implementation Patterns

Pattern 1: Direct User Mapping

User email in dimension table:

// On Customer table
[CustomerEmail] = USERPRINCIPALNAME()

Pattern 2: Security Table

Separate table mapping users to data:

SecurityMapping table:
| UserEmail | Region |
|-----------|--------|
| joe@co.com | West  |
| sue@co.com | East  |
// On Region dimension
[Region] IN 
    SELECTCOLUMNS(
        FILTER(SecurityMapping, [UserEmail] = USERPRINCIPALNAME()),
        "Region", [Region]
    )

Pattern 3: Manager Hierarchy

Users see their data plus subordinates:

// Using PATH functions for hierarchy
PATHCONTAINS(Employee[ManagerPath], 
    LOOKUPVALUE(Employee[EmployeeID], Employee[Email], USERPRINCIPALNAME()))

Pattern 4: Multiple Rules

Combine conditions:

// Users see their region OR if they're a global viewer
[Region] = LOOKUPVALUE(Users[Region], Users[Email], USERPRINCIPALNAME())
|| LOOKUPVALUE(Users[IsGlobal], Users[Email], USERPRINCIPALNAME()) = TRUE()

Creating Roles via MCP

List Existing Roles

security_role_operations(operation: "List")

Create Role with Permission

security_role_operations(
  operation: "Create",
  definitions: [{
    name: "Regional Sales",
    modelPermission: "Read",
    description: "Restricts sales data by region"
  }]
)

Add Table Permission (Filter)

security_role_operations(
  operation: "CreatePermissions",
  permissionDefinitions: [{
    roleName: "Regional Sales",
    tableName: "Customer",
    filterExpression: "[Region] = USERPRINCIPALNAME()"
  }]
)

Get Effective Permissions

security_role_operations(
  operation: "GetEffectivePermissions",
  references: [{ name: "Regional Sales" }]
)

Testing RLS

In Power BI Desktop

  1. Modeling tab > View As
  2. Select role(s) to test
  3. Optionally specify user identity
  4. Verify data filtering

Test Unexpected Values

For dynamic RLS, test:

  • Valid users
  • Unknown users (should see nothing or error gracefully)
  • NULL/blank values
// Defensive pattern - returns no data for unknown users
IF(
    USERPRINCIPALNAME() IN VALUES(SecurityMapping[UserEmail]),
    [Region] IN SELECTCOLUMNS(...),
    FALSE()
)

Common Mistakes

1. RLS on Fact Tables Only

Problem: Large table scans, poor performance Solution: Apply to dimension tables, let relationships propagate

2. Using LOOKUPVALUE Instead of Relationships

Problem: Expensive, doesn't scale Solution: Create proper relationships, let filters flow

3. Expecting Intersection Behavior

Problem: Multiple roles = UNION (additive), not intersection Solution: Design roles with union behavior in mind

4. Forgetting About DirectQuery

Problem: RLS filters become WHERE clauses Solution: Ensure source database can handle the query patterns

5. Not Testing Edge Cases

Problem: Users see unexpected data Solution: Test with: valid users, invalid users, multiple roles

Bidirectional RLS

For bidirectional relationships with RLS:

Enable "Apply security filter in both directions"

Only use when:

  • RLS requires filtering through many-to-many
  • Dimension-to-dimension security needed

Caution: Only one bidirectional relationship per path allowed.

Performance Considerations

  • RLS adds WHERE clauses to every query
  • Complex DAX in filters hurts performance
  • Test with realistic user counts
  • Consider aggregations for large models

Object-Level Security (OLS)

Restrict access to entire tables or columns:

// Via XMLA/TMSL - not available in Desktop UI

Use for:

  • Hiding sensitive columns (salary, SSN)
  • Restricting entire tables
  • Combined with RLS for comprehensive security

Validation Checklist

  • RLS applied to dimension tables (not fact tables)
  • Filters propagate correctly through relationships
  • Dynamic RLS uses USERPRINCIPALNAME()
  • Tested with valid and invalid users
  • Edge cases handled (NULL, unknown users)
  • Performance tested under load
  • Role mappings documented
  • Workspace roles understood (Admins bypass RLS)

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.