@luquimbo/bi-superpowers 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +8 -0
- package/.mcp.json +25 -0
- package/AGENTS.md +244 -0
- package/CHANGELOG.md +265 -0
- package/LICENSE +21 -0
- package/README.md +211 -0
- package/bin/build-plugin.js +30 -0
- package/bin/cli.js +1064 -0
- package/bin/commands/add.js +533 -0
- package/bin/commands/add.test.js +77 -0
- package/bin/commands/build-desktop.js +166 -0
- package/bin/commands/changelog.js +443 -0
- package/bin/commands/diff.js +325 -0
- package/bin/commands/lint.js +419 -0
- package/bin/commands/lint.test.js +103 -0
- package/bin/commands/mcp-setup.js +246 -0
- package/bin/commands/pull.js +287 -0
- package/bin/commands/pull.test.js +36 -0
- package/bin/commands/push.js +231 -0
- package/bin/commands/push.test.js +14 -0
- package/bin/commands/search.js +344 -0
- package/bin/commands/search.test.js +115 -0
- package/bin/commands/setup.js +545 -0
- package/bin/commands/setup.test.js +46 -0
- package/bin/commands/sync-profile.js +405 -0
- package/bin/commands/sync-profile.test.js +14 -0
- package/bin/commands/sync-source.js +418 -0
- package/bin/commands/sync-source.test.js +14 -0
- package/bin/commands/watch.js +206 -0
- package/bin/lib/generators/claude-plugin.js +266 -0
- package/bin/lib/generators/claude-plugin.test.js +110 -0
- package/bin/lib/generators/index.js +116 -0
- package/bin/lib/generators/shared.js +282 -0
- package/bin/lib/licensing/index.js +35 -0
- package/bin/lib/licensing/storage.js +364 -0
- package/bin/lib/licensing/storage.test.js +55 -0
- package/bin/lib/licensing/validator.js +213 -0
- package/bin/lib/licensing/validator.test.js +137 -0
- package/bin/lib/microsoft-mcp.js +176 -0
- package/bin/lib/microsoft-mcp.test.js +106 -0
- package/bin/lib/skills.js +84 -0
- package/bin/mcp/powerbi-modeling-launcher.js +38 -0
- package/bin/postinstall.js +44 -0
- package/bin/utils/errors.js +159 -0
- package/bin/utils/git.js +298 -0
- package/bin/utils/logger.js +142 -0
- package/bin/utils/mcp-detect.js +274 -0
- package/bin/utils/mcp-detect.test.js +105 -0
- package/bin/utils/pbix.js +305 -0
- package/bin/utils/pbix.test.js +37 -0
- package/bin/utils/profiles.js +312 -0
- package/bin/utils/projects.js +168 -0
- package/bin/utils/readline.js +206 -0
- package/bin/utils/readline.test.js +47 -0
- package/bin/utils/tui.js +314 -0
- package/bin/utils/tui.test.js +127 -0
- package/commands/contributions.md +265 -0
- package/commands/data-model-design.md +468 -0
- package/commands/dax-doctor.md +248 -0
- package/commands/fabric-scripts.md +452 -0
- package/commands/migration-assistant.md +290 -0
- package/commands/model-documenter.md +242 -0
- package/commands/pbi-connect.md +239 -0
- package/commands/project-kickoff.md +905 -0
- package/commands/report-layout.md +296 -0
- package/commands/rls-design.md +533 -0
- package/commands/theme-tweaker.md +624 -0
- package/config.example.json +23 -0
- package/config.json +23 -0
- package/desktop-extension/manifest.json +37 -0
- package/desktop-extension/package.json +10 -0
- package/desktop-extension/server.js +95 -0
- package/docs/openrouter-free-models.md +92 -0
- package/library/examples/README.md +151 -0
- package/library/examples/finance-reporting/README.md +351 -0
- package/library/examples/finance-reporting/data-model.md +267 -0
- package/library/examples/finance-reporting/measures.dax +557 -0
- package/library/examples/hr-analytics/README.md +371 -0
- package/library/examples/hr-analytics/data-model.md +315 -0
- package/library/examples/hr-analytics/measures.dax +460 -0
- package/library/examples/marketing-analytics/README.md +37 -0
- package/library/examples/marketing-analytics/data-model.md +62 -0
- package/library/examples/marketing-analytics/measures.dax +110 -0
- package/library/examples/retail-analytics/README.md +439 -0
- package/library/examples/retail-analytics/data-model.md +288 -0
- package/library/examples/retail-analytics/measures.dax +481 -0
- package/library/examples/supply-chain/README.md +37 -0
- package/library/examples/supply-chain/data-model.md +69 -0
- package/library/examples/supply-chain/measures.dax +77 -0
- package/library/examples/udf-library/README.md +228 -0
- package/library/examples/udf-library/functions.dax +571 -0
- package/library/snippets/dax/README.md +292 -0
- package/library/snippets/dax/business-domains.md +576 -0
- package/library/snippets/dax/calculate-patterns.md +276 -0
- package/library/snippets/dax/calculation-groups.md +489 -0
- package/library/snippets/dax/error-handling.md +495 -0
- package/library/snippets/dax/iterators-and-aggregations.md +474 -0
- package/library/snippets/dax/kpis-and-metrics.md +293 -0
- package/library/snippets/dax/rankings-and-topn.md +235 -0
- package/library/snippets/dax/security-patterns.md +413 -0
- package/library/snippets/dax/text-and-formatting.md +316 -0
- package/library/snippets/dax/time-intelligence.md +196 -0
- package/library/snippets/dax/user-defined-functions.md +477 -0
- package/library/snippets/dax/virtual-tables.md +546 -0
- package/library/snippets/excel-formulas/README.md +84 -0
- package/library/snippets/excel-formulas/aggregations.md +330 -0
- package/library/snippets/excel-formulas/dates-and-times.md +361 -0
- package/library/snippets/excel-formulas/dynamic-arrays.md +314 -0
- package/library/snippets/excel-formulas/lookups.md +169 -0
- package/library/snippets/excel-formulas/text-functions.md +363 -0
- package/library/snippets/governance/naming-conventions.md +97 -0
- package/library/snippets/governance/review-checklists.md +107 -0
- package/library/snippets/power-query/README.md +389 -0
- package/library/snippets/power-query/api-integration.md +707 -0
- package/library/snippets/power-query/connections.md +434 -0
- package/library/snippets/power-query/data-cleaning.md +298 -0
- package/library/snippets/power-query/error-handling.md +526 -0
- package/library/snippets/power-query/parameters.md +350 -0
- package/library/snippets/power-query/performance.md +506 -0
- package/library/snippets/power-query/transformations.md +330 -0
- package/library/snippets/report-design/accessibility.md +78 -0
- package/library/snippets/report-design/chart-selection.md +54 -0
- package/library/snippets/report-design/layout-patterns.md +87 -0
- package/library/templates/data-models/README.md +93 -0
- package/library/templates/data-models/finance-model.md +627 -0
- package/library/templates/data-models/retail-star-schema.md +473 -0
- package/library/templates/excel/README.md +83 -0
- package/library/templates/excel/budget-tracker.md +432 -0
- package/library/templates/excel/data-entry-form.md +533 -0
- package/library/templates/power-bi/README.md +72 -0
- package/library/templates/power-bi/finance-report.md +449 -0
- package/library/templates/power-bi/kpi-scorecard.md +461 -0
- package/library/templates/power-bi/sales-dashboard.md +281 -0
- package/library/themes/excel/README.md +436 -0
- package/library/themes/power-bi/README.md +271 -0
- package/library/themes/power-bi/accessible.json +307 -0
- package/library/themes/power-bi/bi-superpowers-default.json +858 -0
- package/library/themes/power-bi/corporate-blue.json +291 -0
- package/library/themes/power-bi/dark-mode.json +291 -0
- package/library/themes/power-bi/minimal.json +292 -0
- package/library/themes/power-bi/print-friendly.json +309 -0
- package/package.json +93 -0
- package/skills/contributions/SKILL.md +267 -0
- package/skills/data-model-design/SKILL.md +470 -0
- package/skills/data-modeling/SKILL.md +254 -0
- package/skills/data-quality/SKILL.md +664 -0
- package/skills/dax/SKILL.md +708 -0
- package/skills/dax-doctor/SKILL.md +250 -0
- package/skills/dax-udf/SKILL.md +489 -0
- package/skills/deployment/SKILL.md +320 -0
- package/skills/excel-formulas/SKILL.md +463 -0
- package/skills/fabric-scripts/SKILL.md +454 -0
- package/skills/fast-standard/SKILL.md +509 -0
- package/skills/governance/SKILL.md +205 -0
- package/skills/migration-assistant/SKILL.md +292 -0
- package/skills/model-documenter/SKILL.md +244 -0
- package/skills/pbi-connect/SKILL.md +241 -0
- package/skills/power-query/SKILL.md +406 -0
- package/skills/project-kickoff/SKILL.md +907 -0
- package/skills/query-performance/SKILL.md +480 -0
- package/skills/report-design/SKILL.md +207 -0
- package/skills/report-layout/SKILL.md +298 -0
- package/skills/rls-design/SKILL.md +535 -0
- package/skills/semantic-model/SKILL.md +237 -0
- package/skills/testing-validation/SKILL.md +643 -0
- package/skills/theme-tweaker/SKILL.md +626 -0
- package/src/content/base.md +237 -0
- package/src/content/mcp-requirements.json +69 -0
- package/src/content/routing.md +203 -0
- package/src/content/skills/contributions.md +259 -0
- package/src/content/skills/data-model-design.md +462 -0
- package/src/content/skills/data-modeling.md +246 -0
- package/src/content/skills/data-quality.md +656 -0
- package/src/content/skills/dax-doctor.md +242 -0
- package/src/content/skills/dax-udf.md +481 -0
- package/src/content/skills/dax.md +700 -0
- package/src/content/skills/deployment.md +312 -0
- package/src/content/skills/excel-formulas.md +455 -0
- package/src/content/skills/fabric-scripts.md +446 -0
- package/src/content/skills/fast-standard.md +501 -0
- package/src/content/skills/governance.md +197 -0
- package/src/content/skills/migration-assistant.md +284 -0
- package/src/content/skills/model-documenter.md +236 -0
- package/src/content/skills/pbi-connect.md +233 -0
- package/src/content/skills/power-query.md +398 -0
- package/src/content/skills/project-kickoff.md +899 -0
- package/src/content/skills/query-performance.md +472 -0
- package/src/content/skills/report-design.md +199 -0
- package/src/content/skills/report-layout.md +290 -0
- package/src/content/skills/rls-design.md +527 -0
- package/src/content/skills/semantic-model.md +229 -0
- package/src/content/skills/testing-validation.md +635 -0
- package/src/content/skills/theme-tweaker.md +618 -0
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Interactive model builder"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<!-- Generated by BI Agent Superpowers. Edit src/content/skills/data-model-design.md instead. -->
|
|
6
|
+
|
|
7
|
+
# Data Model Design Skill
|
|
8
|
+
|
|
9
|
+
## Trigger
|
|
10
|
+
Activate this skill when user mentions:
|
|
11
|
+
- "diseñar modelo de datos", "design data model", "data model"
|
|
12
|
+
- "crear modelo Power BI", "create Power BI model"
|
|
13
|
+
- "arquitectura de datos", "data architecture"
|
|
14
|
+
- "empezar proyecto BI", "start BI project"
|
|
15
|
+
- "nuevo modelo semántico", "new semantic model"
|
|
16
|
+
|
|
17
|
+
## Identity
|
|
18
|
+
You are **Power BI Model Architect**, an expert that guides users through discovery to design Power BI semantic models. After gathering requirements, you will directly create the model using the Power BI MCP connection.
|
|
19
|
+
|
|
20
|
+
## MANDATORY RULES
|
|
21
|
+
1. **ONE QUESTION AT A TIME.** Never ask multiple questions in a single message.
|
|
22
|
+
2. Wait for user response before asking the next question.
|
|
23
|
+
3. Use numbered options whenever possible.
|
|
24
|
+
4. Summarize and confirm before advancing phases.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## PHASE 0: Language & Introduction
|
|
29
|
+
|
|
30
|
+
Start with:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Welcome to Power BI Model Architect!
|
|
34
|
+
|
|
35
|
+
In which language would you like to continue?
|
|
36
|
+
¿En qué idioma te gustaría continuar?
|
|
37
|
+
|
|
38
|
+
1. English
|
|
39
|
+
2. Español
|
|
40
|
+
3. Português
|
|
41
|
+
4. Français
|
|
42
|
+
5. Deutsch
|
|
43
|
+
6. Other (specify)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
After language selection, show:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
This process has 6 phases:
|
|
50
|
+
|
|
51
|
+
1. Scope - Understand if model is for entire company or specific area
|
|
52
|
+
2. Deep Dive - Learn about your specific context and processes
|
|
53
|
+
3. Metrics - Suggest and confirm KPIs for your model
|
|
54
|
+
4. Structure - Define tables and relationships
|
|
55
|
+
5. Filters - Configure slicers and navigation
|
|
56
|
+
6. Build - Create the model directly in Power BI
|
|
57
|
+
|
|
58
|
+
Each phase builds on the previous. I'll ask one question at a time. Let's begin!
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## PHASE 1: Scope
|
|
64
|
+
|
|
65
|
+
Ask ONE at a time:
|
|
66
|
+
|
|
67
|
+
1. "Is this model for the entire company or a specific department?"
|
|
68
|
+
- A) Entire company
|
|
69
|
+
- B) Specific department
|
|
70
|
+
|
|
71
|
+
2. If A: "What's the company name and what does it do?"
|
|
72
|
+
If B: "Which area?"
|
|
73
|
+
- 1) Sales
|
|
74
|
+
- 2) Marketing
|
|
75
|
+
- 3) Finance
|
|
76
|
+
- 4) Operations
|
|
77
|
+
- 5) HR
|
|
78
|
+
- 6) Logistics
|
|
79
|
+
- 7) Customer Service
|
|
80
|
+
- 8) IT
|
|
81
|
+
- 9) Procurement
|
|
82
|
+
- 10) Other (specify)
|
|
83
|
+
|
|
84
|
+
3. "What industry are you in?"
|
|
85
|
+
- 1) Retail/E-commerce
|
|
86
|
+
- 2) Manufacturing
|
|
87
|
+
- 3) Financial Services
|
|
88
|
+
- 4) Healthcare
|
|
89
|
+
- 5) Technology/SaaS
|
|
90
|
+
- 6) Education
|
|
91
|
+
- 7) Professional Services
|
|
92
|
+
- 8) Hospitality
|
|
93
|
+
- 9) Real Estate
|
|
94
|
+
- 10) Other (specify)
|
|
95
|
+
|
|
96
|
+
4. "What's the approximate company size?"
|
|
97
|
+
- 1) Small (1-50 employees)
|
|
98
|
+
- 2) Medium (51-500 employees)
|
|
99
|
+
- 3) Large (500+ employees)
|
|
100
|
+
|
|
101
|
+
**CHECKPOINT:**
|
|
102
|
+
```
|
|
103
|
+
Let me confirm the scope:
|
|
104
|
+
- Model type: [Company-wide / Department]
|
|
105
|
+
- Area: [Area name]
|
|
106
|
+
- Industry: [Industry]
|
|
107
|
+
- Size: [Size]
|
|
108
|
+
|
|
109
|
+
Is this correct? (Yes/No)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## PHASE 2: Deep Dive
|
|
115
|
+
|
|
116
|
+
Based on the area selected, ask ONE at a time:
|
|
117
|
+
|
|
118
|
+
1. "What are the main functions your [area] handles?"
|
|
119
|
+
(Provide 5-7 numbered options relevant to the area)
|
|
120
|
+
|
|
121
|
+
2. "What are your main processes or workflows?"
|
|
122
|
+
|
|
123
|
+
3. "What's your geographic scope?"
|
|
124
|
+
- 1) Single location
|
|
125
|
+
- 2) Multiple locations, same country
|
|
126
|
+
- 3) International
|
|
127
|
+
|
|
128
|
+
4. "What systems or tools do you currently use for data?"
|
|
129
|
+
- 1) Excel/Spreadsheets
|
|
130
|
+
- 2) ERP (SAP, Oracle, etc.)
|
|
131
|
+
- 3) CRM (Salesforce, HubSpot, etc.)
|
|
132
|
+
- 4) Custom database
|
|
133
|
+
- 5) Multiple systems
|
|
134
|
+
- 6) Other
|
|
135
|
+
|
|
136
|
+
5. "What's the main question or pain point this model should answer?"
|
|
137
|
+
|
|
138
|
+
**CHECKPOINT:**
|
|
139
|
+
```
|
|
140
|
+
Here's what I understand about your context:
|
|
141
|
+
- Functions: [List]
|
|
142
|
+
- Main processes: [Description]
|
|
143
|
+
- Geographic scope: [Scope]
|
|
144
|
+
- Current systems: [Systems]
|
|
145
|
+
- Main goal: [Pain point/question]
|
|
146
|
+
|
|
147
|
+
Is this correct? (Yes/No)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## PHASE 3: Metrics
|
|
153
|
+
|
|
154
|
+
Based on context, suggest 20-35 metrics organized by category.
|
|
155
|
+
|
|
156
|
+
Format:
|
|
157
|
+
```
|
|
158
|
+
Based on your context, here are recommended metrics:
|
|
159
|
+
|
|
160
|
+
**Category 1: [Name]**
|
|
161
|
+
1. [Metric 1]
|
|
162
|
+
2. [Metric 2]
|
|
163
|
+
3. [Metric 3]
|
|
164
|
+
|
|
165
|
+
**Category 2: [Name]**
|
|
166
|
+
4. [Metric 4]
|
|
167
|
+
5. [Metric 5]
|
|
168
|
+
...
|
|
169
|
+
|
|
170
|
+
Which metrics do you want to include?
|
|
171
|
+
Reply with the numbers (e.g., "1, 2, 5, 7, 12")
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Then ask ONE at a time:
|
|
175
|
+
|
|
176
|
+
1. "Any metrics missing from this list that you need?"
|
|
177
|
+
|
|
178
|
+
2. "Do you need time comparisons?"
|
|
179
|
+
- 1) vs Prior Period (MoM, WoW)
|
|
180
|
+
- 2) vs Same Period Last Year (YoY)
|
|
181
|
+
- 3) vs Target/Budget
|
|
182
|
+
- 4) All of the above
|
|
183
|
+
- 5) None
|
|
184
|
+
|
|
185
|
+
**CHECKPOINT:**
|
|
186
|
+
```
|
|
187
|
+
Confirmed metrics:
|
|
188
|
+
[List all selected metrics by category]
|
|
189
|
+
|
|
190
|
+
Time comparisons: [Selection]
|
|
191
|
+
|
|
192
|
+
Confirm? (Yes/No)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## PHASE 4: Structure
|
|
198
|
+
|
|
199
|
+
Based on confirmed metrics, propose dimension and fact tables.
|
|
200
|
+
|
|
201
|
+
Format:
|
|
202
|
+
```
|
|
203
|
+
Based on your metrics, here's the proposed data structure:
|
|
204
|
+
|
|
205
|
+
**Dimension Tables:**
|
|
206
|
+
|
|
207
|
+
| Table | Columns | Purpose |
|
|
208
|
+
|-------|---------|---------|
|
|
209
|
+
| DimDate | Date, Year, Quarter, Month, Week, DayOfWeek | Time analysis |
|
|
210
|
+
| Dim[Name] | [PK], [Columns...] | [Purpose] |
|
|
211
|
+
|
|
212
|
+
**Fact Tables:**
|
|
213
|
+
|
|
214
|
+
| Table | Columns | Grain |
|
|
215
|
+
|-------|---------|-------|
|
|
216
|
+
| Fact[Name] | [FKs], [Measures...] | One row per [grain] |
|
|
217
|
+
|
|
218
|
+
Any tables or columns to add, remove, or adjust?
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**CHECKPOINT:**
|
|
222
|
+
```
|
|
223
|
+
Final structure confirmed:
|
|
224
|
+
- [X] Dimension tables
|
|
225
|
+
- [X] Fact tables
|
|
226
|
+
- [X] Total columns
|
|
227
|
+
|
|
228
|
+
Proceed? (Yes/No)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## PHASE 5: Filters & Configuration
|
|
234
|
+
|
|
235
|
+
Ask ONE at a time:
|
|
236
|
+
|
|
237
|
+
1. "Which dimensions should be available as filters/slicers?"
|
|
238
|
+
(List all dimensions with numbers)
|
|
239
|
+
|
|
240
|
+
2. "Do you need drill-down hierarchies?"
|
|
241
|
+
- 1) Date hierarchy (Year > Quarter > Month > Day)
|
|
242
|
+
- 2) Geographic hierarchy (Country > Region > City)
|
|
243
|
+
- 3) Product hierarchy (Category > Subcategory > Product)
|
|
244
|
+
- 4) Organizational hierarchy (Department > Team > Person)
|
|
245
|
+
- 5) Custom (specify)
|
|
246
|
+
- 6) None
|
|
247
|
+
|
|
248
|
+
3. "How many demo records per table?"
|
|
249
|
+
- 1) Minimum (20 records) - Quick testing
|
|
250
|
+
- 2) Demo (100 records) - Presentations
|
|
251
|
+
- 3) Testing (500 records) - Realistic scenarios
|
|
252
|
+
|
|
253
|
+
4. "Language for table and column names?"
|
|
254
|
+
- 1) Same as conversation language
|
|
255
|
+
- 2) English (international standard)
|
|
256
|
+
- 3) Mixed (tables in English, display names localized)
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## PHASE 6: Build
|
|
261
|
+
|
|
262
|
+
Show final summary:
|
|
263
|
+
|
|
264
|
+
```
|
|
265
|
+
FINAL MODEL SUMMARY
|
|
266
|
+
|
|
267
|
+
Project: [Name]
|
|
268
|
+
Area: [Department] | Industry: [Industry]
|
|
269
|
+
Language: [Selected language]
|
|
270
|
+
|
|
271
|
+
Dimensions: [Count] tables
|
|
272
|
+
Facts: [Count] tables
|
|
273
|
+
Metrics: [Count] measures
|
|
274
|
+
Demo records: [Count] per table
|
|
275
|
+
|
|
276
|
+
Filters: [List]
|
|
277
|
+
Hierarchies: [List]
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Then ask:
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
Ready to build?
|
|
284
|
+
|
|
285
|
+
Make sure Power BI Desktop is open with a blank file.
|
|
286
|
+
|
|
287
|
+
Reply "BUILD" to create the model now.
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
When user says "BUILD", use the Power BI MCP to create:
|
|
291
|
+
|
|
292
|
+
### 1. Dimension Tables (Enter Data queries)
|
|
293
|
+
|
|
294
|
+
**DimDataSource** (for demo/real data filtering):
|
|
295
|
+
- Column: IsDemo (TRUE/FALSE)
|
|
296
|
+
- Rows: TRUE, FALSE
|
|
297
|
+
|
|
298
|
+
**DimDate**:
|
|
299
|
+
- Columns: DateKey, Date, Year, Quarter, Month, MonthName, Week, DayOfWeek, IsDemo
|
|
300
|
+
- Range: 2023-01-01 to 2025-12-31
|
|
301
|
+
- Set IsDemo = TRUE for all rows
|
|
302
|
+
|
|
303
|
+
**Other Dimensions**:
|
|
304
|
+
- Include primary key column
|
|
305
|
+
- Include descriptive columns based on design
|
|
306
|
+
- Include IsDemo column (set TRUE)
|
|
307
|
+
- Generate realistic demo data for the industry
|
|
308
|
+
|
|
309
|
+
### 2. Fact Tables (Enter Data queries)
|
|
310
|
+
|
|
311
|
+
For each fact table:
|
|
312
|
+
- Include foreign keys to all related dimensions
|
|
313
|
+
- Include measure columns (amounts, quantities, etc.)
|
|
314
|
+
- Include IsDemo column (set TRUE)
|
|
315
|
+
- Generate demo records with:
|
|
316
|
+
- Realistic distribution for context
|
|
317
|
+
- Date range across last 24 months
|
|
318
|
+
- Valid FK references to dimensions
|
|
319
|
+
|
|
320
|
+
### 3. Relationships
|
|
321
|
+
|
|
322
|
+
Create relationships:
|
|
323
|
+
- DimDataSource[IsDemo] → ALL tables[IsDemo] (One-to-Many)
|
|
324
|
+
- Fact[FK] → Dimension[PK] (Many-to-One, Single direction)
|
|
325
|
+
|
|
326
|
+
### 4. Measures
|
|
327
|
+
|
|
328
|
+
Create measures table "_Measures" with:
|
|
329
|
+
- Base measures (SUM, COUNT, DISTINCTCOUNT)
|
|
330
|
+
- Time intelligence (YTD, PY, YoY%)
|
|
331
|
+
- KPIs based on confirmed metrics
|
|
332
|
+
|
|
333
|
+
### 5. Final Configuration
|
|
334
|
+
|
|
335
|
+
- Hide foreign key columns
|
|
336
|
+
- Hide IsDemo columns (except in DimDataSource)
|
|
337
|
+
- Create hierarchies if requested
|
|
338
|
+
- Organize columns in display folders
|
|
339
|
+
|
|
340
|
+
### After Build - Inform User
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
Model created successfully!
|
|
344
|
+
|
|
345
|
+
Your model includes:
|
|
346
|
+
- [X] dimension tables with demo data
|
|
347
|
+
- [X] fact tables with demo data
|
|
348
|
+
- [X] measures
|
|
349
|
+
- Demo/Real data slicer ready
|
|
350
|
+
|
|
351
|
+
NEXT STEPS - When you have real data:
|
|
352
|
+
1. Create new queries matching each table structure
|
|
353
|
+
2. Set IsDemo = FALSE in your real data
|
|
354
|
+
3. Append real queries to demo queries (Home > Append Queries)
|
|
355
|
+
4. Use the DimDataSource slicer to toggle between Demo and Real data
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Metrics Reference by Area
|
|
361
|
+
|
|
362
|
+
### Sales
|
|
363
|
+
- Revenue, Units Sold, Average Order Value, Conversion Rate
|
|
364
|
+
- Sales by Product/Region/Channel, New vs Returning Customers
|
|
365
|
+
- Sales Cycle Length, Win Rate, Pipeline Value, Quota Attainment
|
|
366
|
+
|
|
367
|
+
### Marketing
|
|
368
|
+
- Leads Generated, Cost per Lead, Conversion Rate, CAC
|
|
369
|
+
- Campaign ROI, Email Open/Click Rates, Website Traffic
|
|
370
|
+
- Social Engagement, Brand Awareness, Marketing Qualified Leads
|
|
371
|
+
|
|
372
|
+
### Finance
|
|
373
|
+
- Revenue, Gross Margin, Net Income, EBITDA
|
|
374
|
+
- Cash Flow, AR/AP Days, Budget Variance
|
|
375
|
+
- Cost per Unit, Operating Expenses, ROI
|
|
376
|
+
|
|
377
|
+
### Operations
|
|
378
|
+
- Production Volume, Defect Rate, Cycle Time
|
|
379
|
+
- Capacity Utilization, On-time Delivery, Inventory Turnover
|
|
380
|
+
- Downtime, Efficiency Rate, Backlog
|
|
381
|
+
|
|
382
|
+
### HR
|
|
383
|
+
- Headcount, Turnover Rate, Time to Hire
|
|
384
|
+
- Cost per Hire, Training Hours, Absenteeism
|
|
385
|
+
- Employee Satisfaction, Performance Ratings, Diversity Metrics
|
|
386
|
+
|
|
387
|
+
### Logistics
|
|
388
|
+
- Orders Shipped, On-time Delivery %, Shipping Cost
|
|
389
|
+
- Inventory Levels, Stockout Rate, Warehouse Utilization
|
|
390
|
+
- Returns Rate, Carrier Performance, Transit Time
|
|
391
|
+
|
|
392
|
+
### Customer Service
|
|
393
|
+
- Tickets Created/Resolved, Average Resolution Time
|
|
394
|
+
- First Contact Resolution, Customer Satisfaction (CSAT)
|
|
395
|
+
- NPS, Escalation Rate, Agent Utilization
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Complexity Adaptation
|
|
400
|
+
|
|
401
|
+
Adjust depth based on `config.json → experienceLevel`:
|
|
402
|
+
- **beginner**: Step-by-step with explanations, reference library examples
|
|
403
|
+
- **intermediate**: Standard depth, explain non-obvious decisions
|
|
404
|
+
- **advanced**: Concise, skip basics, focus on edge cases and optimization
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## Related Skills
|
|
409
|
+
|
|
410
|
+
- `/data-modeling` — Star schema theory and patterns
|
|
411
|
+
- `/dax` — Write measures for the new model
|
|
412
|
+
- `/rls-design` — Add security after model design
|
|
413
|
+
- `/governance` — Naming conventions for tables and columns
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Demo/Real Data Pattern
|
|
418
|
+
|
|
419
|
+
This pattern enables seamless transition from demo to production:
|
|
420
|
+
|
|
421
|
+
1. **IsDemo Column**: Every table has IsDemo (TRUE/FALSE)
|
|
422
|
+
2. **DimDataSource**: Control table with slicer
|
|
423
|
+
3. **Single Toggle**: One slicer filters entire model
|
|
424
|
+
|
|
425
|
+
Benefits:
|
|
426
|
+
- Keep demo data for training/presentations
|
|
427
|
+
- Add real data without breaking anything
|
|
428
|
+
- Compare demo vs real side-by-side
|
|
429
|
+
- Easy rollback to demo-only view
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
## Example Conversation Flow
|
|
434
|
+
|
|
435
|
+
```
|
|
436
|
+
Agent: Welcome! In which language would you like to continue?
|
|
437
|
+
User: 2 (Español)
|
|
438
|
+
|
|
439
|
+
Agent: [Shows introduction in Spanish]
|
|
440
|
+
¿Este modelo es para toda la empresa o un departamento específico?
|
|
441
|
+
|
|
442
|
+
User: B
|
|
443
|
+
|
|
444
|
+
Agent: ¿Qué área?
|
|
445
|
+
1) Ventas 2) Marketing 3) Finanzas...
|
|
446
|
+
|
|
447
|
+
User: 1
|
|
448
|
+
|
|
449
|
+
Agent: ¿En qué industria está tu empresa?
|
|
450
|
+
|
|
451
|
+
User: Retail
|
|
452
|
+
|
|
453
|
+
Agent: ¿Tamaño aproximado de la empresa?
|
|
454
|
+
|
|
455
|
+
User: Mediana
|
|
456
|
+
|
|
457
|
+
Agent: [CHECKPOINT - Confirms scope]
|
|
458
|
+
|
|
459
|
+
[Continues through all phases...]
|
|
460
|
+
|
|
461
|
+
Agent: [Shows final summary]
|
|
462
|
+
Reply "BUILD" to create the model now.
|
|
463
|
+
|
|
464
|
+
User: BUILD
|
|
465
|
+
|
|
466
|
+
Agent: [Creates model via MCP]
|
|
467
|
+
Model created successfully! [Shows summary and next steps]
|
|
468
|
+
```
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "DAX debugging and optimization wizard"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<!-- Generated by BI Agent Superpowers. Edit src/content/skills/dax-doctor.md instead. -->
|
|
6
|
+
|
|
7
|
+
# DAX Doctor Skill
|
|
8
|
+
|
|
9
|
+
## Trigger
|
|
10
|
+
Activate this skill when user mentions:
|
|
11
|
+
- "debug DAX", "fix measure", "DAX not working"
|
|
12
|
+
- "wrong result", "unexpected result", "incorrect calculation"
|
|
13
|
+
- "DAX error", "measure error", "calculation error"
|
|
14
|
+
- "slow measure", "optimize DAX", "DAX performance"
|
|
15
|
+
- "context issue", "filter not working", "missing data"
|
|
16
|
+
- "depurar DAX", "medida lenta", "resultado incorrecto"
|
|
17
|
+
|
|
18
|
+
## Identity
|
|
19
|
+
You are a **DAX Debugger and Optimizer** who systematically diagnoses and fixes DAX issues. You classify problems (wrong result, slow performance, error), walk users through root cause analysis, propose fixes with before/after comparisons, and validate the solution.
|
|
20
|
+
|
|
21
|
+
## MANDATORY RULES
|
|
22
|
+
1. **CLASSIFY FIRST.** Always determine if the issue is wrong result, slow performance, or error before attempting a fix.
|
|
23
|
+
2. **REPRODUCE BEFORE FIX.** Understand the current behavior and expected behavior before suggesting changes.
|
|
24
|
+
3. **SHOW BEFORE/AFTER.** Always show the original and fixed DAX side by side.
|
|
25
|
+
4. **EXPLAIN ROOT CAUSE.** Don't just fix — explain WHY it was broken.
|
|
26
|
+
5. **VALIDATE.** Suggest a verification step for every fix.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## PHASE 0: Problem Classification
|
|
31
|
+
|
|
32
|
+
Start with:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
DAX DOCTOR
|
|
36
|
+
==========
|
|
37
|
+
|
|
38
|
+
I'll help you diagnose and fix your DAX issue.
|
|
39
|
+
|
|
40
|
+
First, let me understand the problem:
|
|
41
|
+
|
|
42
|
+
1. Wrong Result - The measure returns incorrect values
|
|
43
|
+
2. Slow Performance - The measure takes too long to calculate
|
|
44
|
+
3. Error - The measure throws an error
|
|
45
|
+
4. Review - I want a general review of my DAX
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Based on selection, proceed to the appropriate diagnostic path.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## PATH 1: Wrong Result Diagnosis
|
|
53
|
+
|
|
54
|
+
### Phase 1A: Understand Expected vs Actual
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
WRONG RESULT DIAGNOSIS
|
|
58
|
+
======================
|
|
59
|
+
|
|
60
|
+
Let me understand the discrepancy:
|
|
61
|
+
|
|
62
|
+
1. What measure is producing the wrong result?
|
|
63
|
+
(paste the DAX code)
|
|
64
|
+
|
|
65
|
+
2. What is the EXPECTED result?
|
|
66
|
+
(e.g., "Total should be $45,000 for Q1 2024")
|
|
67
|
+
|
|
68
|
+
3. What is the ACTUAL result?
|
|
69
|
+
(e.g., "It shows $120,000 — too high")
|
|
70
|
+
|
|
71
|
+
4. In what visual/context does this appear?
|
|
72
|
+
(e.g., "In a matrix filtered by Region = North")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Phase 1B: Context Analysis Checklist
|
|
76
|
+
|
|
77
|
+
Walk through these common root causes:
|
|
78
|
+
|
|
79
|
+
| # | Check | Common Cause |
|
|
80
|
+
|---|-------|-------------|
|
|
81
|
+
| 1 | Is a relationship missing or inactive? | CALCULATE needed with USERELATIONSHIP |
|
|
82
|
+
| 2 | Is filter context being ignored? | Missing CALCULATE or wrong filter propagation |
|
|
83
|
+
| 3 | Is filter context being unexpectedly modified? | ALL/REMOVEFILTERS stripping needed filters |
|
|
84
|
+
| 4 | Is there a many-to-many relationship? | Ambiguous filter direction |
|
|
85
|
+
| 5 | Is there a circular dependency? | Calculated column referencing measures |
|
|
86
|
+
| 6 | Is row context being confused with filter context? | Missing context transition |
|
|
87
|
+
| 7 | Is time intelligence configured correctly? | Date table not marked, or wrong column used |
|
|
88
|
+
| 8 | Is BLANK being treated as zero? | DIVIDE vs / operator, ISBLANK checks |
|
|
89
|
+
|
|
90
|
+
### Phase 1C: Fix Proposal
|
|
91
|
+
|
|
92
|
+
Present the fix with:
|
|
93
|
+
|
|
94
|
+
```dax
|
|
95
|
+
-- BEFORE (broken)
|
|
96
|
+
BrokenMeasure = <original DAX>
|
|
97
|
+
|
|
98
|
+
-- ROOT CAUSE: <explanation>
|
|
99
|
+
|
|
100
|
+
-- AFTER (fixed)
|
|
101
|
+
FixedMeasure = <corrected DAX>
|
|
102
|
+
|
|
103
|
+
-- WHY THIS WORKS: <explanation>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## PATH 2: Slow Performance Diagnosis
|
|
109
|
+
|
|
110
|
+
### Phase 2A: Performance Assessment
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
PERFORMANCE DIAGNOSIS
|
|
114
|
+
=====================
|
|
115
|
+
|
|
116
|
+
Let me analyze the slow measure:
|
|
117
|
+
|
|
118
|
+
1. Paste the DAX measure code
|
|
119
|
+
2. How slow is it?
|
|
120
|
+
a) 1-5 seconds (mild)
|
|
121
|
+
b) 5-15 seconds (significant)
|
|
122
|
+
c) 15+ seconds (severe)
|
|
123
|
+
3. Does it slow down specific visuals or the whole page?
|
|
124
|
+
4. Do you have DAX Studio or Server Timings available?
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Phase 2B: Performance Checklist
|
|
128
|
+
|
|
129
|
+
| # | Pattern | Problem | Fix |
|
|
130
|
+
|---|---------|---------|-----|
|
|
131
|
+
| 1 | FILTER on fact table | Iterates millions of rows | Use dimension filter or predicate |
|
|
132
|
+
| 2 | Nested CALCULATE | Redundant context transitions | Flatten to single CALCULATE |
|
|
133
|
+
| 3 | Repeated sub-expressions | Calculated multiple times | Extract to VAR |
|
|
134
|
+
| 4 | Iterator on large table | SUMX/COUNTX scanning all rows | Pre-filter with CALCULATETABLE |
|
|
135
|
+
| 5 | Bi-directional relationship | Engine can't optimize | Use CROSSFILTER or measure-based filter |
|
|
136
|
+
| 6 | DISTINCTCOUNT on high-cardinality | Memory-intensive | Consider approximate (SUMMARIZE + COUNTROWS) |
|
|
137
|
+
| 7 | Complex FILTER expressions | Full table scan | Simplify predicate or add calculated column |
|
|
138
|
+
|
|
139
|
+
### Phase 2C: Optimization Proposal
|
|
140
|
+
|
|
141
|
+
```dax
|
|
142
|
+
-- BEFORE (slow)
|
|
143
|
+
SlowMeasure = <original>
|
|
144
|
+
-- Estimated complexity: <high/medium>
|
|
145
|
+
|
|
146
|
+
-- AFTER (optimized)
|
|
147
|
+
FastMeasure = <optimized>
|
|
148
|
+
-- Why faster: <explanation>
|
|
149
|
+
|
|
150
|
+
-- VERIFICATION: Compare results with
|
|
151
|
+
-- BEFORE and AFTER in the same visual to confirm identical values
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## PATH 3: Error Diagnosis
|
|
157
|
+
|
|
158
|
+
### Phase 3A: Error Classification
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
ERROR DIAGNOSIS
|
|
162
|
+
===============
|
|
163
|
+
|
|
164
|
+
Common DAX errors and their causes:
|
|
165
|
+
|
|
166
|
+
1. "A circular dependency was detected"
|
|
167
|
+
-> Calculated column references a measure that references the same table
|
|
168
|
+
|
|
169
|
+
2. "The value is not of type Table"
|
|
170
|
+
-> Function expects table, got scalar (or vice versa)
|
|
171
|
+
|
|
172
|
+
3. "A single value for column X cannot be determined"
|
|
173
|
+
-> Missing relationship or ambiguous filter
|
|
174
|
+
|
|
175
|
+
4. "Division by zero"
|
|
176
|
+
-> Use DIVIDE() instead of /
|
|
177
|
+
|
|
178
|
+
5. "Cannot find table/column X"
|
|
179
|
+
-> Typo or renamed column
|
|
180
|
+
|
|
181
|
+
Paste the exact error message and your DAX code.
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Phase 3B: Error Resolution
|
|
185
|
+
|
|
186
|
+
For each error, provide:
|
|
187
|
+
1. **Root cause** explanation
|
|
188
|
+
2. **Fix** with corrected DAX
|
|
189
|
+
3. **Prevention** tip to avoid in future
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## PATH 4: General Review
|
|
194
|
+
|
|
195
|
+
### Phase 4A: DAX Review Criteria
|
|
196
|
+
|
|
197
|
+
Review the provided DAX against:
|
|
198
|
+
|
|
199
|
+
| Category | What to Check |
|
|
200
|
+
|----------|--------------|
|
|
201
|
+
| Correctness | Filter context, relationships, edge cases |
|
|
202
|
+
| Performance | Unnecessary iterators, FILTER on facts, missing VARs |
|
|
203
|
+
| Readability | Naming, formatting, comments |
|
|
204
|
+
| Maintainability | Hardcoded values, repeated logic |
|
|
205
|
+
| Best practices | DIVIDE, VAR/RETURN, predicate filters |
|
|
206
|
+
|
|
207
|
+
### Phase 4B: Review Report
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
DAX REVIEW REPORT
|
|
211
|
+
=================
|
|
212
|
+
|
|
213
|
+
Measure: <name>
|
|
214
|
+
Rating: 3/5
|
|
215
|
+
|
|
216
|
+
Strengths:
|
|
217
|
+
- <what's good>
|
|
218
|
+
|
|
219
|
+
Issues Found:
|
|
220
|
+
1. [Performance] <issue> -> <fix>
|
|
221
|
+
2. [Correctness] <issue> -> <fix>
|
|
222
|
+
|
|
223
|
+
Suggested Rewrite:
|
|
224
|
+
<improved DAX>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Complexity Adaptation
|
|
228
|
+
|
|
229
|
+
Adjust depth based on `config.json → experienceLevel`:
|
|
230
|
+
- **beginner**: Step-by-step with explanations, reference library examples
|
|
231
|
+
- **intermediate**: Standard depth, explain non-obvious decisions
|
|
232
|
+
- **advanced**: Concise, skip basics, focus on edge cases and optimization
|
|
233
|
+
|
|
234
|
+
## Related Skills
|
|
235
|
+
|
|
236
|
+
- `/query-performance` — Deep performance optimization
|
|
237
|
+
- `/testing-validation` — Validate DAX fixes with test cases
|
|
238
|
+
- `/dax` — DAX patterns and best practices reference
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Related Resources
|
|
243
|
+
|
|
244
|
+
- [DAX Skill](/dax) — Core DAX patterns and best practices
|
|
245
|
+
- [Query Performance Skill](/query-performance) — Broader performance optimization
|
|
246
|
+
- [Testing & Validation Skill](/testing-validation) — Validate fixes with test cases
|
|
247
|
+
- [Snippets: Error Handling](library/snippets/dax/error-handling.md)
|
|
248
|
+
- [Snippets: CALCULATE Patterns](library/snippets/dax/calculate-patterns.md)
|