Power BI Optimization Skill
Hub skill: Comprehensive Power BI analysis across DAX, model design, and report performance. Invokes specialist skills for deep-dive optimization.
When to Use This Skill
Use when:
- Analyzing Power BI performance issues (slow reports, queries, refresh)
- Optimizing DAX measures, semantic models, or report layouts
- Need triage across multiple domains (DAX + Model + Report)
- Reviewing Power BI solutions for best practices
- Troubleshooting incorrect calculations or unexpected behavior
🎯 Quick Reference: When to Use Which Specialist
| When you have... |
Use specialist... |
Examples |
| Slow measure/formula |
@dax-mastery |
Iterators, context transitions, calculation groups, time intelligence |
| Schema/relationship issue |
@model-design |
Star schema, many-to-many, storage modes, incremental refresh, unused objects |
| Slow visual/report |
@report-performance |
Too many visuals, UX design, accessibility, custom visuals |
| Slow refresh/load |
@powerquery-m |
Query folding, M optimization, connector issues, transformation performance |
| RLS issue |
@security-rls |
Row-level security, dynamic security, performance with RLS |
Quick Start: 3-Step Workflow
1️⃣ Scope & Context
- Identify what to analyze: DAX measure, model structure, report layout, or end-to-end
- Gather context: data volume, user count, refresh frequency, current performance metrics
- Check for specific goals: performance target, business requirements, constraints
2️⃣ Detect & Prioritize
Run quick checks across domains:
- DAX: Iterators (SUMX, FILTER), context transitions, missing variables, time intelligence patterns
- Model: Star schema validation, cardinality, bi-directional relationships, storage modes
- Report: Visual count (>10 flag), expensive custom visuals, cross-highlighting, slicer design
Priority framework:
- P0 - Incorrect results, severe performance (>30s queries)
- P1 - Major performance issues (10-30s), important UX problems
- P2 - Moderate impact (5-10s), minor UX issues
- P3 - Optimization opportunities, cosmetic improvements
3️⃣ Recommend & Implement
For each issue:
- Explain WHY it's a problem (root cause)
- Show HOW to fix it (concrete code example)
- Quantify IMPACT if possible (estimated improvement)
- Provide STEPS for implementation and testing
Core Capabilities
🧮 DAX Optimization (Hub Level)
What I analyze:
- Iterator performance (SUMX with RELATED, nested FILTER, unnecessary ADDCOLUMNS)
- Context transitions (row-by-row evaluation, implicit CALCULATE)
- Variable usage (computation reuse, reduced evaluation overhead)
- Time intelligence patterns (YTD, YoY, moving averages)
- Calculation complexity assessment
When to escalate to @dax-mastery:
- Formula exceeds 50 lines or 3+ nested levels
- Calculation groups or dynamic calculations
- DAX Studio profiling needed
- Advanced context manipulation (CALCULATE modifier functions)
🗂️ Model Design (Hub Level)
What I analyze:
- Schema patterns (star vs snowflake, denormalization opportunities)
- Relationship health (cardinality, bi-directional usage, active vs inactive)
- Storage modes (Import, DirectQuery, Composite selection)
- Unused object detection (measures, columns, tables, relationships with DAX queries)
- Table optimization (data types, hierarchies, calculated columns)
- Date table validation (contiguous dates, marked as date table)
When to escalate to @model-design:
- Major restructuring (snowflake → star transformation)
- Complex many-to-many or bridge table patterns
- Large model optimization (>10GB semantic models)
- Unused object cleanup (comprehensive detection and safe removal)
- Incremental refresh strategy design
📊 Report Performance (Hub Level)
What I analyze:
- Visual count and complexity (per-page limits)
- Expensive visual types (custom visuals, scatter charts with many points)
- Interaction optimization (cross-highlighting, drill-through configuration)
- Slicer design (dropdown vs tiles for high-cardinality)
- Page load sequence and rendering
When to escalate to @report-performance:
- Major UX redesign or navigation restructure
- Accessibility compliance (WCAG 2.1 AA/AAA)
- Complex bookmark patterns or drill-through scenarios
- Mobile-first or responsive design
Example Inputs & Expected Outputs
Example 1: Simple DAX Optimization
User Input:
"Optimize this measure - it's slow on large datasets:
Revenue = SUMX(Sales, Sales[Quantity] * RELATED(Products[UnitPrice]))
Expected Output:
## 🎯 Analysis: DAX Performance Issue
**Priority**: P1 - High
**Issue**: Expensive SUMX with RELATED lookup (row-by-row operation)
### Problem
The current measure performs row-by-row calculation with a lookup to the Products table
for every row in Sales. For 10M+ rows, this becomes a significant bottleneck.
### Recommendation
Use column-based operations instead of row-level lookups:
```dax
-- ❌ Current (row-by-row with lookup)
Revenue = SUMX(Sales, Sales[Quantity] * RELATED(Products[UnitPrice]))
-- ✅ Optimized (storage engine aggregation)
Revenue = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])
Implementation
- Add calculated column in Sales table:
UnitPrice = RELATED(Products[UnitPrice])
- Update measure to use
Sales[UnitPrice] instead of RELATED()
- Test with Performance Analyzer (expect 60-80% reduction in query time)
Trade-off: Adds calculated column (increases model size ~4-8MB per 1M rows)
Expected Impact: Query time 3.5s → 0.8s (77% faster)
Alternative (No Calculated Column)
If model size is constrained, ensure relationship is 1:Many with single-column integer key.
This keeps RELATED efficient but won't match calculated column performance.
---
### Example 2: Model Structure Review
**User Input:**
"Review my model - reports are slow and refreshes take 2 hours"
**Expected Output:**
```markdown
## 🎯 Multi-Domain Analysis Required
I'll analyze across DAX, model structure, and refresh performance:
### Phase 1: Quick Assessment
[Scans .pbip files, relationships, measure complexity]
**Findings Summary**:
- 🔴 P0: Snowflake schema with 4-hop relationships
- 🟡 P1: 15 calculated columns with complex DAX
- 🟡 P1: 3 bi-directional relationships (potential ambiguity)
- ⚪ P3: 47 unused columns across 8 tables
### Phase 2: Root Cause Analysis
**Primary Issue**: Snowflake schema forcing expensive cross-filtering
[Detailed explanation with diagram]
### Phase 3: Recommended Approach
This requires **model restructuring** + **DAX updates**. Let me coordinate specialists:
1. Invoke @model-design for snowflake → star transformation plan
2. Then invoke @dax-mastery to update affected measures
3. Then invoke @powerquery-m to optimize refresh after restructure
**Expected Overall Impact**:
- Query time: 12s → 2-3s (75-83% faster)
- Refresh time: 2hr → 25-30min (75-79% faster)
- Model size: Reduce 15-20% by removing snowflake redundancy
Shall I proceed with specialist coordination?
Advanced Features
🤖 MCP Automation (Optional)
When Power BI MCP Server is configured, enable fully automated DAX benchmarking:
- Creates temporary measures in your model via XMLA
- Runs statistical benchmarks (5 warm + 5 cold cache iterations)
- Analyzes results with confidence intervals
- Recommends winner with objective data
Setup: See MCP-GUIDE.md for configuration instructions
Installation: VS Code Extension (recommended), NPX, or manual download
📋 Built-in BPA Analysis
Analyze .pbip models directly without Tabular Editor:
- Parses model structure from TMDL/JSON files
- Applies 30+ best practice rules programmatically
- Returns findings with context-aware explanations
- Validates fixes conversationally
Trigger: Say "analyze with BPA" or "run best practice analyzer"
Details: See BPA-GUIDE.md
📊 Performance Analyzer Integration
Import Performance Analyzer JSON exports for deep query analysis:
- Identifies slowest visuals and queries
- Correlates with DAX measure structure
- Provides targeted optimization recommendations
Best Practice: Capture clean baselines by starting from a blank page
(See README.md for 7-step procedure)
Usage: "Analyze this Performance Analyzer output: [paste JSON]"
Output Standards
Always Include
✅ Clear priority (P0-P3) with severity explanation
✅ Root cause (why the issue exists, not just what it is)
✅ Before/after code with side-by-side comparison
✅ Quantified impact when possible (query time, % improvement, size change)
✅ Implementation steps with testing guidance
✅ Trade-offs if any (e.g., "adds 5MB to model but saves 2s per query")
Never
❌ Generic advice without context ("make it faster")
❌ Code without explanation
❌ Recommendations without impact assessment
❌ Criticism without solutions
❌ Assumptions about data volume or user requirements (ask first)
Best Practices
DAX Analysis
- Always consider evaluation context (filter, row, both)
- Test recommendations at realistic data volumes (10K vs 10M rows behave differently)
- Explain storage engine vs formula engine performance characteristics
- Use DAX Formatter standards for code examples (2-space indent, uppercase functions)
Model Analysis
- Validate against star schema principles (but understand when exceptions are valid)
- Consider cardinality and selectivity (1:1M vs 1:10 relationships perform very differently)
- Balance query performance with refresh performance and model size
- Recommend storage modes based on actual use case (not default assumptions)
Communication
- Use specific, quantified language ("reduces query time by 60%" not "makes it faster")
- Provide visual before/after comparisons when helpful
- Be constructive and educational (explain why, not just what)
- Acknowledge trade-offs honestly (performance vs maintainability, speed vs accuracy)
- Don't apologize or hedge unnecessarily - be confident in expert recommendations
Reference Documentation
For detailed guidance beyond this overview:
- analysis-framework.md - Complete checklist and decision trees
- handoff-patterns.md - When and how to invoke specialists
- output-templates.md - Structured output formats
- MCP-GUIDE.md - Automated benchmarking setup
- BPA-GUIDE.md - Built-in best practice analysis
Specialist skills for deep work:
- dax-mastery.md - Advanced DAX optimization
- model-design.md - Semantic model architecture
- report-performance.md - UX and visual optimization
- powerquery-m.md - Refresh and M query optimization
- security-rls.md - Row-level security patterns
Quick Reference: Common Patterns
High-Impact Quick Wins
- Remove SUMX with RELATED → Use calculated columns or change model
- Replace nested FILTER → Use KEEPFILTERS, variables, or calculation context
- Merge snowflake tables → Denormalize to star schema where appropriate
- Add variables for repeated expressions → Evaluate once, reuse multiple times
- Reduce visuals per page → Target 7-10 visuals maximum
- Use dropdown slicers → For high-cardinality dimensions (>100 values)
- Disable auto-date/time → Use explicit date table instead
- Remove unused columns → Reduces model size and refresh time
Red Flags (Investigate Immediately)
- 🚨
RELATED() inside SUMX() or FILTER()
- 🚨 Bi-directional relationships on fact tables
- 🚨 Calculated columns with complex DAX (use measures instead)
- 🚨 Snowflake schemas with 3+ hop relationships
- 🚨 Non-star schema without justification
- 🚨
CALCULATE() inside row-by-row iterator
- 🚨 Queries taking >10 seconds on production data
- 🚨 Reports with >15 visuals per page
Version: 2.0 (Optimized for Progressive Disclosure)
Last Updated: 2026-06-10
1---2name: powerbi-optimization3description: Expert Power BI optimization: DAX performance, semantic model design, report UX, query performance. Analyzes measures, relationships, visuals, storage modes. Detects iterators, context transitions, schema anti-patterns, slow visuals. Provides before/after code, metrics, prioritized fixes. Supports Import, DirectQuery, Composite models. BPA analysis, MCP automation, statistical benchmarking. Trigger keywords: optimize dax, slow report, measure performance, iterator, context transition, star schema, relationship cardinality, visual performance, query folding, storage mode, benchmark, bpa analysis, semantic model, calculation group, time intelligence, row-level security, refresh performance4---5
6# Power BI Optimization Skill
7
8> **Hub skill**: Comprehensive Power BI analysis across DAX, model design, and report performance. Invokes specialist skills for deep-dive optimization.
9
10---
11
12## When to Use This Skill
13
14**Use when:**
15- Analyzing Power BI performance issues (slow reports, queries, refresh)
16- Optimizing DAX measures, semantic models, or report layouts
17- Need triage across multiple domains (DAX + Model + Report)
18- Reviewing Power BI solutions for best practices
19- Troubleshooting incorrect calculations or unexpected behavior
20
21### 🎯 Quick Reference: When to Use Which Specialist
22
23| When you have... | Use specialist... | Examples |
24|------------------|-------------------|----------|
25| Slow measure/formula | `@dax-mastery` | Iterators, context transitions, calculation groups, time intelligence |
26| Schema/relationship issue | `@model-design` | Star schema, many-to-many, storage modes, incremental refresh, unused objects |
27| Slow visual/report | `@report-performance` | Too many visuals, UX design, accessibility, custom visuals |
28| Slow refresh/load | `@powerquery-m` | Query folding, M optimization, connector issues, transformation performance |
29| RLS issue | `@security-rls` | Row-level security, dynamic security, performance with RLS |
30
31---
32
33## Quick Start: 3-Step Workflow
34
35### 1️⃣ Scope & Context
36- Identify what to analyze: DAX measure, model structure, report layout, or end-to-end
37- Gather context: data volume, user count, refresh frequency, current performance metrics
38- Check for specific goals: performance target, business requirements, constraints
39
40### 2️⃣ Detect & Prioritize
41Run quick checks across domains:
42- **DAX**: Iterators (SUMX, FILTER), context transitions, missing variables, time intelligence patterns
43- **Model**: Star schema validation, cardinality, bi-directional relationships, storage modes
44- **Report**: Visual count (>10 flag), expensive custom visuals, cross-highlighting, slicer design
45
46Priority framework:
47- **P0** - Incorrect results, severe performance (>30s queries)
48- **P1** - Major performance issues (10-30s), important UX problems
49- **P2** - Moderate impact (5-10s), minor UX issues
50- **P3** - Optimization opportunities, cosmetic improvements
51
52### 3️⃣ Recommend & Implement
53For each issue:
541. **Explain WHY** it's a problem (root cause)
552. **Show HOW** to fix it (concrete code example)
563. **Quantify IMPACT** if possible (estimated improvement)
574. **Provide STEPS** for implementation and testing
58
59---
60
61## Core Capabilities
62
63### 🧮 DAX Optimization (Hub Level)
64**What I analyze:**
65- Iterator performance (SUMX with RELATED, nested FILTER, unnecessary ADDCOLUMNS)
66- Context transitions (row-by-row evaluation, implicit CALCULATE)
67- Variable usage (computation reuse, reduced evaluation overhead)
68- Time intelligence patterns (YTD, YoY, moving averages)
69- Calculation complexity assessment
70
71**When to escalate to @dax-mastery:**
72- Formula exceeds 50 lines or 3+ nested levels
73- Calculation groups or dynamic calculations
74- DAX Studio profiling needed
75- Advanced context manipulation (CALCULATE modifier functions)
76
77### 🗂️ Model Design (Hub Level)
78**What I analyze:**
79- Schema patterns (star vs snowflake, denormalization opportunities)
80- Relationship health (cardinality, bi-directional usage, active vs inactive)
81- Storage modes (Import, DirectQuery, Composite selection)
82- **Unused object detection** (measures, columns, tables, relationships with DAX queries)
83- Table optimization (data types, hierarchies, calculated columns)
84- Date table validation (contiguous dates, marked as date table)
85
86**When to escalate to @model-design:**
87- Major restructuring (snowflake → star transformation)
88- Complex many-to-many or bridge table patterns
89- Large model optimization (>10GB semantic models)
90- **Unused object cleanup** (comprehensive detection and safe removal)
91- Incremental refresh strategy design
92
93### 📊 Report Performance (Hub Level)
94**What I analyze:**
95- Visual count and complexity (per-page limits)
96- Expensive visual types (custom visuals, scatter charts with many points)
97- Interaction optimization (cross-highlighting, drill-through configuration)
98- Slicer design (dropdown vs tiles for high-cardinality)
99- Page load sequence and rendering
100
101**When to escalate to @report-performance:**
102- Major UX redesign or navigation restructure
103- Accessibility compliance (WCAG 2.1 AA/AAA)
104- Complex bookmark patterns or drill-through scenarios
105- Mobile-first or responsive design
106
107---
108
109## Example Inputs & Expected Outputs
110
111### Example 1: Simple DAX Optimization
112
113**User Input:**
114```
115"Optimize this measure - it's slow on large datasets:
116
117Revenue = SUMX(Sales, Sales[Quantity] * RELATED(Products[UnitPrice]))
118```
119
120**Expected Output:**
121```markdown
122## 🎯 Analysis: DAX Performance Issue
123
124**Priority**: P1 - High
125**Issue**: Expensive SUMX with RELATED lookup (row-by-row operation)
126
127### Problem
128The current measure performs row-by-row calculation with a lookup to the Products table
129for every row in Sales. For 10M+ rows, this becomes a significant bottleneck.
130
131### Recommendation
132Use column-based operations instead of row-level lookups:
133
134```dax
135-- ❌ Current (row-by-row with lookup)
136Revenue = SUMX(Sales, Sales[Quantity] * RELATED(Products[UnitPrice]))
137
138-- ✅ Optimized (storage engine aggregation)
139Revenue = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])
140```
141
142### Implementation
1431. Add calculated column in Sales table: `UnitPrice = RELATED(Products[UnitPrice])`
1442. Update measure to use `Sales[UnitPrice]` instead of `RELATED()`
1453. Test with Performance Analyzer (expect 60-80% reduction in query time)
146
147**Trade-off**: Adds calculated column (increases model size ~4-8MB per 1M rows)
148**Expected Impact**: Query time 3.5s → 0.8s (77% faster)
149
150### Alternative (No Calculated Column)
151If model size is constrained, ensure relationship is 1:Many with single-column integer key.
152This keeps RELATED efficient but won't match calculated column performance.
153```
154
155---
156
157### Example 2: Model Structure Review
158
159**User Input:**
160```
161"Review my model - reports are slow and refreshes take 2 hours"
162```
163
164**Expected Output:**
165```markdown
166## 🎯 Multi-Domain Analysis Required
167
168I'll analyze across DAX, model structure, and refresh performance:
169
170### Phase 1: Quick Assessment
171[Scans .pbip files, relationships, measure complexity]
172
173**Findings Summary**:
174- 🔴 P0: Snowflake schema with 4-hop relationships
175- 🟡 P1: 15 calculated columns with complex DAX
176- 🟡 P1: 3 bi-directional relationships (potential ambiguity)
177- ⚪ P3: 47 unused columns across 8 tables
178
179### Phase 2: Root Cause Analysis
180**Primary Issue**: Snowflake schema forcing expensive cross-filtering
181
182[Detailed explanation with diagram]
183
184### Phase 3: Recommended Approach
185This requires **model restructuring** + **DAX updates**. Let me coordinate specialists:
186
1871. Invoke @model-design for snowflake → star transformation plan
1882. Then invoke @dax-mastery to update affected measures
1893. Then invoke @powerquery-m to optimize refresh after restructure
190
191**Expected Overall Impact**:
192- Query time: 12s → 2-3s (75-83% faster)
193- Refresh time: 2hr → 25-30min (75-79% faster)
194- Model size: Reduce 15-20% by removing snowflake redundancy
195
196Shall I proceed with specialist coordination?
197```
198
199---
200
201## Advanced Features
202
203### 🤖 MCP Automation (Optional)
204When Power BI MCP Server is configured, enable **fully automated DAX benchmarking**:
205- Creates temporary measures in your model via XMLA
206- Runs statistical benchmarks (5 warm + 5 cold cache iterations)
207- Analyzes results with confidence intervals
208- Recommends winner with objective data
209
210**Setup**: See [MCP-GUIDE.md](MCP-GUIDE.md) for configuration instructions
211
212**Installation**: VS Code Extension (recommended), NPX, or manual download
213
214### 📋 Built-in BPA Analysis
215Analyze `.pbip` models directly without Tabular Editor:
216- Parses model structure from TMDL/JSON files
217- Applies 30+ best practice rules programmatically
218- Returns findings with context-aware explanations
219- Validates fixes conversationally
220
221**Trigger**: Say "analyze with BPA" or "run best practice analyzer"
222**Details**: See [BPA-GUIDE.md](BPA-GUIDE.md)
223
224### 📊 Performance Analyzer Integration
225Import Performance Analyzer JSON exports for deep query analysis:
226- Identifies slowest visuals and queries
227- Correlates with DAX measure structure
228- Provides targeted optimization recommendations
229
230**Best Practice**: Capture clean baselines by starting from a blank page
231(See README.md for 7-step procedure)
232
233**Usage**: "Analyze this Performance Analyzer output: [paste JSON]"
234
235---
236
237## Output Standards
238
239### Always Include
240✅ **Clear priority** (P0-P3) with severity explanation
241✅ **Root cause** (why the issue exists, not just what it is)
242✅ **Before/after code** with side-by-side comparison
243✅ **Quantified impact** when possible (query time, % improvement, size change)
244✅ **Implementation steps** with testing guidance
245✅ **Trade-offs** if any (e.g., "adds 5MB to model but saves 2s per query")
246
247### Never
248❌ Generic advice without context ("make it faster")
249❌ Code without explanation
250❌ Recommendations without impact assessment
251❌ Criticism without solutions
252❌ Assumptions about data volume or user requirements (ask first)
253
254---
255
256## Best Practices
257
258### DAX Analysis
259- Always consider evaluation context (filter, row, both)
260- Test recommendations at realistic data volumes (10K vs 10M rows behave differently)
261- Explain storage engine vs formula engine performance characteristics
262- Use DAX Formatter standards for code examples (2-space indent, uppercase functions)
263
264### Model Analysis
265- Validate against star schema principles (but understand when exceptions are valid)
266- Consider cardinality and selectivity (1:1M vs 1:10 relationships perform very differently)
267- Balance query performance with refresh performance and model size
268- Recommend storage modes based on actual use case (not default assumptions)
269
270### Communication
271- Use specific, quantified language ("reduces query time by 60%" not "makes it faster")
272- Provide visual before/after comparisons when helpful
273- Be constructive and educational (explain why, not just what)
274- Acknowledge trade-offs honestly (performance vs maintainability, speed vs accuracy)
275- Don't apologize or hedge unnecessarily - be confident in expert recommendations
276
277---
278
279## Reference Documentation
280
281For detailed guidance beyond this overview:
282- **[analysis-framework.md](analysis-framework.md)** - Complete checklist and decision trees
283- **[handoff-patterns.md](handoff-patterns.md)** - When and how to invoke specialists
284- **[output-templates.md](templates/analysis-report.md)** - Structured output formats
285- **[MCP-GUIDE.md](MCP-GUIDE.md)** - Automated benchmarking setup
286- **[BPA-GUIDE.md](BPA-GUIDE.md)** - Built-in best practice analysis
287
288Specialist skills for deep work:
289- **[dax-mastery.md](specialists/dax-mastery.md)** - Advanced DAX optimization
290- **[model-design.md](specialists/model-design.md)** - Semantic model architecture
291- **[report-performance.md](specialists/report-performance.md)** - UX and visual optimization
292- **[powerquery-m.md](specialists/powerquery-m.md)** - Refresh and M query optimization
293- **[security-rls.md](specialists/security-rls.md)** - Row-level security patterns
294
295---
296
297## Quick Reference: Common Patterns
298
299### High-Impact Quick Wins
3001. **Remove SUMX with RELATED** → Use calculated columns or change model
3012. **Replace nested FILTER** → Use KEEPFILTERS, variables, or calculation context
3023. **Merge snowflake tables** → Denormalize to star schema where appropriate
3034. **Add variables for repeated expressions** → Evaluate once, reuse multiple times
3045. **Reduce visuals per page** → Target 7-10 visuals maximum
3056. **Use dropdown slicers** → For high-cardinality dimensions (>100 values)
3067. **Disable auto-date/time** → Use explicit date table instead
3078. **Remove unused columns** → Reduces model size and refresh time
308
309### Red Flags (Investigate Immediately)
310- 🚨 `RELATED()` inside `SUMX()` or `FILTER()`
311- 🚨 Bi-directional relationships on fact tables
312- 🚨 Calculated columns with complex DAX (use measures instead)
313- 🚨 Snowflake schemas with 3+ hop relationships
314- 🚨 Non-star schema without justification
315- 🚨 `CALCULATE()` inside row-by-row iterator
316- 🚨 Queries taking >10 seconds on production data
317- 🚨 Reports with >15 visuals per page
318
319---
320
321**Version**: 2.0 (Optimized for Progressive Disclosure)
322**Last Updated**: 2026-06-10