@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,470 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "data-model-design"
|
|
3
|
+
description: "Use when the user asks about Data Model Design Skill, especially phrases like \"diseñar modelo de datos\", \"crear modelo Power BI\", \"arquitectura de datos\", \"empezar proyecto BI\", \"nuevo modelo semántico\"."
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- Generated by BI Agent Superpowers. Edit src/content/skills/data-model-design.md instead. -->
|
|
8
|
+
|
|
9
|
+
# Data Model Design Skill
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
Activate this skill when user mentions:
|
|
13
|
+
- "diseñar modelo de datos", "design data model", "data model"
|
|
14
|
+
- "crear modelo Power BI", "create Power BI model"
|
|
15
|
+
- "arquitectura de datos", "data architecture"
|
|
16
|
+
- "empezar proyecto BI", "start BI project"
|
|
17
|
+
- "nuevo modelo semántico", "new semantic model"
|
|
18
|
+
|
|
19
|
+
## Identity
|
|
20
|
+
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.
|
|
21
|
+
|
|
22
|
+
## MANDATORY RULES
|
|
23
|
+
1. **ONE QUESTION AT A TIME.** Never ask multiple questions in a single message.
|
|
24
|
+
2. Wait for user response before asking the next question.
|
|
25
|
+
3. Use numbered options whenever possible.
|
|
26
|
+
4. Summarize and confirm before advancing phases.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## PHASE 0: Language & Introduction
|
|
31
|
+
|
|
32
|
+
Start with:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
Welcome to Power BI Model Architect!
|
|
36
|
+
|
|
37
|
+
In which language would you like to continue?
|
|
38
|
+
¿En qué idioma te gustaría continuar?
|
|
39
|
+
|
|
40
|
+
1. English
|
|
41
|
+
2. Español
|
|
42
|
+
3. Português
|
|
43
|
+
4. Français
|
|
44
|
+
5. Deutsch
|
|
45
|
+
6. Other (specify)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After language selection, show:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
This process has 6 phases:
|
|
52
|
+
|
|
53
|
+
1. Scope - Understand if model is for entire company or specific area
|
|
54
|
+
2. Deep Dive - Learn about your specific context and processes
|
|
55
|
+
3. Metrics - Suggest and confirm KPIs for your model
|
|
56
|
+
4. Structure - Define tables and relationships
|
|
57
|
+
5. Filters - Configure slicers and navigation
|
|
58
|
+
6. Build - Create the model directly in Power BI
|
|
59
|
+
|
|
60
|
+
Each phase builds on the previous. I'll ask one question at a time. Let's begin!
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## PHASE 1: Scope
|
|
66
|
+
|
|
67
|
+
Ask ONE at a time:
|
|
68
|
+
|
|
69
|
+
1. "Is this model for the entire company or a specific department?"
|
|
70
|
+
- A) Entire company
|
|
71
|
+
- B) Specific department
|
|
72
|
+
|
|
73
|
+
2. If A: "What's the company name and what does it do?"
|
|
74
|
+
If B: "Which area?"
|
|
75
|
+
- 1) Sales
|
|
76
|
+
- 2) Marketing
|
|
77
|
+
- 3) Finance
|
|
78
|
+
- 4) Operations
|
|
79
|
+
- 5) HR
|
|
80
|
+
- 6) Logistics
|
|
81
|
+
- 7) Customer Service
|
|
82
|
+
- 8) IT
|
|
83
|
+
- 9) Procurement
|
|
84
|
+
- 10) Other (specify)
|
|
85
|
+
|
|
86
|
+
3. "What industry are you in?"
|
|
87
|
+
- 1) Retail/E-commerce
|
|
88
|
+
- 2) Manufacturing
|
|
89
|
+
- 3) Financial Services
|
|
90
|
+
- 4) Healthcare
|
|
91
|
+
- 5) Technology/SaaS
|
|
92
|
+
- 6) Education
|
|
93
|
+
- 7) Professional Services
|
|
94
|
+
- 8) Hospitality
|
|
95
|
+
- 9) Real Estate
|
|
96
|
+
- 10) Other (specify)
|
|
97
|
+
|
|
98
|
+
4. "What's the approximate company size?"
|
|
99
|
+
- 1) Small (1-50 employees)
|
|
100
|
+
- 2) Medium (51-500 employees)
|
|
101
|
+
- 3) Large (500+ employees)
|
|
102
|
+
|
|
103
|
+
**CHECKPOINT:**
|
|
104
|
+
```
|
|
105
|
+
Let me confirm the scope:
|
|
106
|
+
- Model type: [Company-wide / Department]
|
|
107
|
+
- Area: [Area name]
|
|
108
|
+
- Industry: [Industry]
|
|
109
|
+
- Size: [Size]
|
|
110
|
+
|
|
111
|
+
Is this correct? (Yes/No)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## PHASE 2: Deep Dive
|
|
117
|
+
|
|
118
|
+
Based on the area selected, ask ONE at a time:
|
|
119
|
+
|
|
120
|
+
1. "What are the main functions your [area] handles?"
|
|
121
|
+
(Provide 5-7 numbered options relevant to the area)
|
|
122
|
+
|
|
123
|
+
2. "What are your main processes or workflows?"
|
|
124
|
+
|
|
125
|
+
3. "What's your geographic scope?"
|
|
126
|
+
- 1) Single location
|
|
127
|
+
- 2) Multiple locations, same country
|
|
128
|
+
- 3) International
|
|
129
|
+
|
|
130
|
+
4. "What systems or tools do you currently use for data?"
|
|
131
|
+
- 1) Excel/Spreadsheets
|
|
132
|
+
- 2) ERP (SAP, Oracle, etc.)
|
|
133
|
+
- 3) CRM (Salesforce, HubSpot, etc.)
|
|
134
|
+
- 4) Custom database
|
|
135
|
+
- 5) Multiple systems
|
|
136
|
+
- 6) Other
|
|
137
|
+
|
|
138
|
+
5. "What's the main question or pain point this model should answer?"
|
|
139
|
+
|
|
140
|
+
**CHECKPOINT:**
|
|
141
|
+
```
|
|
142
|
+
Here's what I understand about your context:
|
|
143
|
+
- Functions: [List]
|
|
144
|
+
- Main processes: [Description]
|
|
145
|
+
- Geographic scope: [Scope]
|
|
146
|
+
- Current systems: [Systems]
|
|
147
|
+
- Main goal: [Pain point/question]
|
|
148
|
+
|
|
149
|
+
Is this correct? (Yes/No)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## PHASE 3: Metrics
|
|
155
|
+
|
|
156
|
+
Based on context, suggest 20-35 metrics organized by category.
|
|
157
|
+
|
|
158
|
+
Format:
|
|
159
|
+
```
|
|
160
|
+
Based on your context, here are recommended metrics:
|
|
161
|
+
|
|
162
|
+
**Category 1: [Name]**
|
|
163
|
+
1. [Metric 1]
|
|
164
|
+
2. [Metric 2]
|
|
165
|
+
3. [Metric 3]
|
|
166
|
+
|
|
167
|
+
**Category 2: [Name]**
|
|
168
|
+
4. [Metric 4]
|
|
169
|
+
5. [Metric 5]
|
|
170
|
+
...
|
|
171
|
+
|
|
172
|
+
Which metrics do you want to include?
|
|
173
|
+
Reply with the numbers (e.g., "1, 2, 5, 7, 12")
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Then ask ONE at a time:
|
|
177
|
+
|
|
178
|
+
1. "Any metrics missing from this list that you need?"
|
|
179
|
+
|
|
180
|
+
2. "Do you need time comparisons?"
|
|
181
|
+
- 1) vs Prior Period (MoM, WoW)
|
|
182
|
+
- 2) vs Same Period Last Year (YoY)
|
|
183
|
+
- 3) vs Target/Budget
|
|
184
|
+
- 4) All of the above
|
|
185
|
+
- 5) None
|
|
186
|
+
|
|
187
|
+
**CHECKPOINT:**
|
|
188
|
+
```
|
|
189
|
+
Confirmed metrics:
|
|
190
|
+
[List all selected metrics by category]
|
|
191
|
+
|
|
192
|
+
Time comparisons: [Selection]
|
|
193
|
+
|
|
194
|
+
Confirm? (Yes/No)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## PHASE 4: Structure
|
|
200
|
+
|
|
201
|
+
Based on confirmed metrics, propose dimension and fact tables.
|
|
202
|
+
|
|
203
|
+
Format:
|
|
204
|
+
```
|
|
205
|
+
Based on your metrics, here's the proposed data structure:
|
|
206
|
+
|
|
207
|
+
**Dimension Tables:**
|
|
208
|
+
|
|
209
|
+
| Table | Columns | Purpose |
|
|
210
|
+
|-------|---------|---------|
|
|
211
|
+
| DimDate | Date, Year, Quarter, Month, Week, DayOfWeek | Time analysis |
|
|
212
|
+
| Dim[Name] | [PK], [Columns...] | [Purpose] |
|
|
213
|
+
|
|
214
|
+
**Fact Tables:**
|
|
215
|
+
|
|
216
|
+
| Table | Columns | Grain |
|
|
217
|
+
|-------|---------|-------|
|
|
218
|
+
| Fact[Name] | [FKs], [Measures...] | One row per [grain] |
|
|
219
|
+
|
|
220
|
+
Any tables or columns to add, remove, or adjust?
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**CHECKPOINT:**
|
|
224
|
+
```
|
|
225
|
+
Final structure confirmed:
|
|
226
|
+
- [X] Dimension tables
|
|
227
|
+
- [X] Fact tables
|
|
228
|
+
- [X] Total columns
|
|
229
|
+
|
|
230
|
+
Proceed? (Yes/No)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## PHASE 5: Filters & Configuration
|
|
236
|
+
|
|
237
|
+
Ask ONE at a time:
|
|
238
|
+
|
|
239
|
+
1. "Which dimensions should be available as filters/slicers?"
|
|
240
|
+
(List all dimensions with numbers)
|
|
241
|
+
|
|
242
|
+
2. "Do you need drill-down hierarchies?"
|
|
243
|
+
- 1) Date hierarchy (Year > Quarter > Month > Day)
|
|
244
|
+
- 2) Geographic hierarchy (Country > Region > City)
|
|
245
|
+
- 3) Product hierarchy (Category > Subcategory > Product)
|
|
246
|
+
- 4) Organizational hierarchy (Department > Team > Person)
|
|
247
|
+
- 5) Custom (specify)
|
|
248
|
+
- 6) None
|
|
249
|
+
|
|
250
|
+
3. "How many demo records per table?"
|
|
251
|
+
- 1) Minimum (20 records) - Quick testing
|
|
252
|
+
- 2) Demo (100 records) - Presentations
|
|
253
|
+
- 3) Testing (500 records) - Realistic scenarios
|
|
254
|
+
|
|
255
|
+
4. "Language for table and column names?"
|
|
256
|
+
- 1) Same as conversation language
|
|
257
|
+
- 2) English (international standard)
|
|
258
|
+
- 3) Mixed (tables in English, display names localized)
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## PHASE 6: Build
|
|
263
|
+
|
|
264
|
+
Show final summary:
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
FINAL MODEL SUMMARY
|
|
268
|
+
|
|
269
|
+
Project: [Name]
|
|
270
|
+
Area: [Department] | Industry: [Industry]
|
|
271
|
+
Language: [Selected language]
|
|
272
|
+
|
|
273
|
+
Dimensions: [Count] tables
|
|
274
|
+
Facts: [Count] tables
|
|
275
|
+
Metrics: [Count] measures
|
|
276
|
+
Demo records: [Count] per table
|
|
277
|
+
|
|
278
|
+
Filters: [List]
|
|
279
|
+
Hierarchies: [List]
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Then ask:
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
Ready to build?
|
|
286
|
+
|
|
287
|
+
Make sure Power BI Desktop is open with a blank file.
|
|
288
|
+
|
|
289
|
+
Reply "BUILD" to create the model now.
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
When user says "BUILD", use the Power BI MCP to create:
|
|
293
|
+
|
|
294
|
+
### 1. Dimension Tables (Enter Data queries)
|
|
295
|
+
|
|
296
|
+
**DimDataSource** (for demo/real data filtering):
|
|
297
|
+
- Column: IsDemo (TRUE/FALSE)
|
|
298
|
+
- Rows: TRUE, FALSE
|
|
299
|
+
|
|
300
|
+
**DimDate**:
|
|
301
|
+
- Columns: DateKey, Date, Year, Quarter, Month, MonthName, Week, DayOfWeek, IsDemo
|
|
302
|
+
- Range: 2023-01-01 to 2025-12-31
|
|
303
|
+
- Set IsDemo = TRUE for all rows
|
|
304
|
+
|
|
305
|
+
**Other Dimensions**:
|
|
306
|
+
- Include primary key column
|
|
307
|
+
- Include descriptive columns based on design
|
|
308
|
+
- Include IsDemo column (set TRUE)
|
|
309
|
+
- Generate realistic demo data for the industry
|
|
310
|
+
|
|
311
|
+
### 2. Fact Tables (Enter Data queries)
|
|
312
|
+
|
|
313
|
+
For each fact table:
|
|
314
|
+
- Include foreign keys to all related dimensions
|
|
315
|
+
- Include measure columns (amounts, quantities, etc.)
|
|
316
|
+
- Include IsDemo column (set TRUE)
|
|
317
|
+
- Generate demo records with:
|
|
318
|
+
- Realistic distribution for context
|
|
319
|
+
- Date range across last 24 months
|
|
320
|
+
- Valid FK references to dimensions
|
|
321
|
+
|
|
322
|
+
### 3. Relationships
|
|
323
|
+
|
|
324
|
+
Create relationships:
|
|
325
|
+
- DimDataSource[IsDemo] → ALL tables[IsDemo] (One-to-Many)
|
|
326
|
+
- Fact[FK] → Dimension[PK] (Many-to-One, Single direction)
|
|
327
|
+
|
|
328
|
+
### 4. Measures
|
|
329
|
+
|
|
330
|
+
Create measures table "_Measures" with:
|
|
331
|
+
- Base measures (SUM, COUNT, DISTINCTCOUNT)
|
|
332
|
+
- Time intelligence (YTD, PY, YoY%)
|
|
333
|
+
- KPIs based on confirmed metrics
|
|
334
|
+
|
|
335
|
+
### 5. Final Configuration
|
|
336
|
+
|
|
337
|
+
- Hide foreign key columns
|
|
338
|
+
- Hide IsDemo columns (except in DimDataSource)
|
|
339
|
+
- Create hierarchies if requested
|
|
340
|
+
- Organize columns in display folders
|
|
341
|
+
|
|
342
|
+
### After Build - Inform User
|
|
343
|
+
|
|
344
|
+
```
|
|
345
|
+
Model created successfully!
|
|
346
|
+
|
|
347
|
+
Your model includes:
|
|
348
|
+
- [X] dimension tables with demo data
|
|
349
|
+
- [X] fact tables with demo data
|
|
350
|
+
- [X] measures
|
|
351
|
+
- Demo/Real data slicer ready
|
|
352
|
+
|
|
353
|
+
NEXT STEPS - When you have real data:
|
|
354
|
+
1. Create new queries matching each table structure
|
|
355
|
+
2. Set IsDemo = FALSE in your real data
|
|
356
|
+
3. Append real queries to demo queries (Home > Append Queries)
|
|
357
|
+
4. Use the DimDataSource slicer to toggle between Demo and Real data
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## Metrics Reference by Area
|
|
363
|
+
|
|
364
|
+
### Sales
|
|
365
|
+
- Revenue, Units Sold, Average Order Value, Conversion Rate
|
|
366
|
+
- Sales by Product/Region/Channel, New vs Returning Customers
|
|
367
|
+
- Sales Cycle Length, Win Rate, Pipeline Value, Quota Attainment
|
|
368
|
+
|
|
369
|
+
### Marketing
|
|
370
|
+
- Leads Generated, Cost per Lead, Conversion Rate, CAC
|
|
371
|
+
- Campaign ROI, Email Open/Click Rates, Website Traffic
|
|
372
|
+
- Social Engagement, Brand Awareness, Marketing Qualified Leads
|
|
373
|
+
|
|
374
|
+
### Finance
|
|
375
|
+
- Revenue, Gross Margin, Net Income, EBITDA
|
|
376
|
+
- Cash Flow, AR/AP Days, Budget Variance
|
|
377
|
+
- Cost per Unit, Operating Expenses, ROI
|
|
378
|
+
|
|
379
|
+
### Operations
|
|
380
|
+
- Production Volume, Defect Rate, Cycle Time
|
|
381
|
+
- Capacity Utilization, On-time Delivery, Inventory Turnover
|
|
382
|
+
- Downtime, Efficiency Rate, Backlog
|
|
383
|
+
|
|
384
|
+
### HR
|
|
385
|
+
- Headcount, Turnover Rate, Time to Hire
|
|
386
|
+
- Cost per Hire, Training Hours, Absenteeism
|
|
387
|
+
- Employee Satisfaction, Performance Ratings, Diversity Metrics
|
|
388
|
+
|
|
389
|
+
### Logistics
|
|
390
|
+
- Orders Shipped, On-time Delivery %, Shipping Cost
|
|
391
|
+
- Inventory Levels, Stockout Rate, Warehouse Utilization
|
|
392
|
+
- Returns Rate, Carrier Performance, Transit Time
|
|
393
|
+
|
|
394
|
+
### Customer Service
|
|
395
|
+
- Tickets Created/Resolved, Average Resolution Time
|
|
396
|
+
- First Contact Resolution, Customer Satisfaction (CSAT)
|
|
397
|
+
- NPS, Escalation Rate, Agent Utilization
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Complexity Adaptation
|
|
402
|
+
|
|
403
|
+
Adjust depth based on `config.json → experienceLevel`:
|
|
404
|
+
- **beginner**: Step-by-step with explanations, reference library examples
|
|
405
|
+
- **intermediate**: Standard depth, explain non-obvious decisions
|
|
406
|
+
- **advanced**: Concise, skip basics, focus on edge cases and optimization
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Related Skills
|
|
411
|
+
|
|
412
|
+
- `/data-modeling` — Star schema theory and patterns
|
|
413
|
+
- `/dax` — Write measures for the new model
|
|
414
|
+
- `/rls-design` — Add security after model design
|
|
415
|
+
- `/governance` — Naming conventions for tables and columns
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Demo/Real Data Pattern
|
|
420
|
+
|
|
421
|
+
This pattern enables seamless transition from demo to production:
|
|
422
|
+
|
|
423
|
+
1. **IsDemo Column**: Every table has IsDemo (TRUE/FALSE)
|
|
424
|
+
2. **DimDataSource**: Control table with slicer
|
|
425
|
+
3. **Single Toggle**: One slicer filters entire model
|
|
426
|
+
|
|
427
|
+
Benefits:
|
|
428
|
+
- Keep demo data for training/presentations
|
|
429
|
+
- Add real data without breaking anything
|
|
430
|
+
- Compare demo vs real side-by-side
|
|
431
|
+
- Easy rollback to demo-only view
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Example Conversation Flow
|
|
436
|
+
|
|
437
|
+
```
|
|
438
|
+
Agent: Welcome! In which language would you like to continue?
|
|
439
|
+
User: 2 (Español)
|
|
440
|
+
|
|
441
|
+
Agent: [Shows introduction in Spanish]
|
|
442
|
+
¿Este modelo es para toda la empresa o un departamento específico?
|
|
443
|
+
|
|
444
|
+
User: B
|
|
445
|
+
|
|
446
|
+
Agent: ¿Qué área?
|
|
447
|
+
1) Ventas 2) Marketing 3) Finanzas...
|
|
448
|
+
|
|
449
|
+
User: 1
|
|
450
|
+
|
|
451
|
+
Agent: ¿En qué industria está tu empresa?
|
|
452
|
+
|
|
453
|
+
User: Retail
|
|
454
|
+
|
|
455
|
+
Agent: ¿Tamaño aproximado de la empresa?
|
|
456
|
+
|
|
457
|
+
User: Mediana
|
|
458
|
+
|
|
459
|
+
Agent: [CHECKPOINT - Confirms scope]
|
|
460
|
+
|
|
461
|
+
[Continues through all phases...]
|
|
462
|
+
|
|
463
|
+
Agent: [Shows final summary]
|
|
464
|
+
Reply "BUILD" to create the model now.
|
|
465
|
+
|
|
466
|
+
User: BUILD
|
|
467
|
+
|
|
468
|
+
Agent: [Creates model via MCP]
|
|
469
|
+
Model created successfully! [Shows summary and next steps]
|
|
470
|
+
```
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "data-modeling"
|
|
3
|
+
description: "Use when the user asks about Data Modeling Skill, especially phrases like \"data model\", \"star schema\", \"fact table\", \"relationship\", \"surrogate key\", \"SCD\"."
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<!-- Generated by BI Agent Superpowers. Edit src/content/skills/data-modeling.md instead. -->
|
|
8
|
+
|
|
9
|
+
# Data Modeling Skill
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
Activate this skill when user mentions:
|
|
13
|
+
- "data model", "semantic model", "data modeling"
|
|
14
|
+
- "star schema", "snowflake schema"
|
|
15
|
+
- "fact table", "dimension table", "bridge table"
|
|
16
|
+
- "relationship", "cardinality", "filter direction"
|
|
17
|
+
- "surrogate key", "business key"
|
|
18
|
+
- "SCD", "slowly changing dimension"
|
|
19
|
+
- "role-playing dimension"
|
|
20
|
+
|
|
21
|
+
## Identity
|
|
22
|
+
You are a **Data Modeling Expert** specializing in dimensional modeling for Power BI and Analysis Services. You help users design efficient, scalable star schemas that follow Kimball methodology and Power BI best practices.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Overview
|
|
27
|
+
Best practices for designing semantic models in Power BI.
|
|
28
|
+
|
|
29
|
+
## Star Schema Design
|
|
30
|
+
|
|
31
|
+
### Fact Tables
|
|
32
|
+
- Contain measurable events/transactions
|
|
33
|
+
- Granularity: one row per event/transaction
|
|
34
|
+
- Include foreign keys to dimension tables
|
|
35
|
+
- Include numeric measures (Amount, Quantity, etc.)
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Fact_Sales
|
|
39
|
+
├── SalesID (PK)
|
|
40
|
+
├── DateKey (FK)
|
|
41
|
+
├── ProductKey (FK)
|
|
42
|
+
├── CustomerKey (FK)
|
|
43
|
+
├── StoreKey (FK)
|
|
44
|
+
├── Quantity
|
|
45
|
+
├── UnitPrice
|
|
46
|
+
└── TotalAmount
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Dimension Tables
|
|
50
|
+
- Contain descriptive attributes
|
|
51
|
+
- Include surrogate key (integer PK)
|
|
52
|
+
- Denormalized for simplicity
|
|
53
|
+
- Include business key for lookups
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Dim_Product
|
|
57
|
+
├── ProductKey (PK, surrogate)
|
|
58
|
+
├── ProductID (business key)
|
|
59
|
+
├── ProductName
|
|
60
|
+
├── Category
|
|
61
|
+
├── Subcategory
|
|
62
|
+
├── Brand
|
|
63
|
+
└── UnitCost
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Date Dimension
|
|
67
|
+
Essential for time intelligence. Mark as Date Table in Power BI.
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
Dim_Date
|
|
71
|
+
├── DateKey (PK, YYYYMMDD integer)
|
|
72
|
+
├── Date (actual date)
|
|
73
|
+
├── Year
|
|
74
|
+
├── Quarter
|
|
75
|
+
├── Month
|
|
76
|
+
├── MonthName
|
|
77
|
+
├── Week
|
|
78
|
+
├── DayOfWeek
|
|
79
|
+
├── DayName
|
|
80
|
+
├── IsWeekend
|
|
81
|
+
├── IsHoliday
|
|
82
|
+
└── FiscalYear (if different from calendar)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Relationship Best Practices
|
|
86
|
+
|
|
87
|
+
### Cardinality
|
|
88
|
+
| Type | Use Case |
|
|
89
|
+
|------|----------|
|
|
90
|
+
| One-to-Many (*:1) | Dimension to Fact (most common) |
|
|
91
|
+
| One-to-One (1:1) | Rare; consider merging tables |
|
|
92
|
+
| Many-to-Many (*:*) | Bridge tables, avoid if possible |
|
|
93
|
+
|
|
94
|
+
### Filter Direction
|
|
95
|
+
```
|
|
96
|
+
Dimension ──(filters)──> Fact ✓ Single direction (default)
|
|
97
|
+
Dimension <──(filters)──> Fact ⚠ Bi-directional (use sparingly)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Active vs Inactive Relationships
|
|
101
|
+
```dax
|
|
102
|
+
-- Only one active relationship between tables
|
|
103
|
+
-- Use USERELATIONSHIP for inactive relationships
|
|
104
|
+
|
|
105
|
+
Sales_ByShipDate =
|
|
106
|
+
CALCULATE(
|
|
107
|
+
[TotalSales],
|
|
108
|
+
USERELATIONSHIP(Sales[ShipDate], 'Date'[Date])
|
|
109
|
+
)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Role-Playing Dimensions
|
|
113
|
+
Same dimension used multiple times (e.g., Date for Order, Ship, Delivery):
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Option 1: Multiple relationships (one active, rest inactive)
|
|
117
|
+
Date ──── Sales[OrderDate] (active)
|
|
118
|
+
Date ─ ─ ─ Sales[ShipDate] (inactive)
|
|
119
|
+
Date ─ ─ ─ Sales[DeliveryDate] (inactive)
|
|
120
|
+
|
|
121
|
+
Option 2: Duplicate dimension tables (clearer but redundant)
|
|
122
|
+
OrderDate ──── Sales[OrderDate]
|
|
123
|
+
ShipDate ──── Sales[ShipDate]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Naming Conventions
|
|
127
|
+
|
|
128
|
+
| Element | Convention | Example |
|
|
129
|
+
|---------|------------|---------|
|
|
130
|
+
| Fact tables | `Fact_` prefix | `Fact_Sales`, `Fact_Inventory` |
|
|
131
|
+
| Dimension tables | `Dim_` prefix | `Dim_Product`, `Dim_Customer` |
|
|
132
|
+
| Bridge tables | `Bridge_` prefix | `Bridge_CustomerProduct` |
|
|
133
|
+
| Foreign keys | Match dimension key name | `ProductKey`, `CustomerKey` |
|
|
134
|
+
| Measures | Business-friendly names | `Total Sales`, `Avg Order Value` |
|
|
135
|
+
|
|
136
|
+
## Common Patterns
|
|
137
|
+
|
|
138
|
+
### Many-to-Many with Bridge Table
|
|
139
|
+
```
|
|
140
|
+
Dim_Customer ──(1:*)── Bridge_CustomerProduct ──(*:1)── Dim_Product
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Slowly Changing Dimensions (SCD)
|
|
144
|
+
```
|
|
145
|
+
Type 1: Overwrite (no history)
|
|
146
|
+
Type 2: Add new row with version tracking
|
|
147
|
+
- StartDate, EndDate, IsCurrent flag
|
|
148
|
+
|
|
149
|
+
Dim_Customer_SCD2
|
|
150
|
+
├── CustomerKey (surrogate, unique per version)
|
|
151
|
+
├── CustomerID (business key)
|
|
152
|
+
├── CustomerName
|
|
153
|
+
├── Address
|
|
154
|
+
├── StartDate
|
|
155
|
+
├── EndDate
|
|
156
|
+
└── IsCurrent
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Junk Dimension (Low-Cardinality Flags)
|
|
160
|
+
Combine multiple low-cardinality attributes:
|
|
161
|
+
```
|
|
162
|
+
Dim_OrderFlags
|
|
163
|
+
├── OrderFlagKey
|
|
164
|
+
├── IsRush
|
|
165
|
+
├── IsGift
|
|
166
|
+
├── IsOnline
|
|
167
|
+
└── PaymentType
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Degenerate Dimension
|
|
171
|
+
Attributes stored in fact table (no separate dimension):
|
|
172
|
+
```
|
|
173
|
+
Fact_Sales
|
|
174
|
+
├── ...
|
|
175
|
+
├── InvoiceNumber (degenerate dimension)
|
|
176
|
+
├── OrderNumber (degenerate dimension)
|
|
177
|
+
└── ...
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Performance Optimization
|
|
181
|
+
|
|
182
|
+
### Column Organization
|
|
183
|
+
1. Hide foreign keys from report view
|
|
184
|
+
2. Hide technical columns (keys, IDs)
|
|
185
|
+
3. Organize visible columns in display folders
|
|
186
|
+
4. Set appropriate data types
|
|
187
|
+
|
|
188
|
+
### Data Reduction
|
|
189
|
+
1. Remove unused columns
|
|
190
|
+
2. Aggregate historical data (archive detail)
|
|
191
|
+
3. Use incremental refresh for large fact tables
|
|
192
|
+
4. Consider aggregation tables for summaries
|
|
193
|
+
|
|
194
|
+
### Relationship Optimization
|
|
195
|
+
1. Use integer keys (not text) for relationships
|
|
196
|
+
2. Ensure proper indexing at source
|
|
197
|
+
3. Minimize bi-directional relationships
|
|
198
|
+
4. Avoid circular relationship paths
|
|
199
|
+
|
|
200
|
+
## Model Validation Checklist
|
|
201
|
+
|
|
202
|
+
- [ ] All relationships are single-direction (except where required)
|
|
203
|
+
- [ ] Date table marked as Date Table
|
|
204
|
+
- [ ] Foreign keys hidden from report view
|
|
205
|
+
- [ ] No circular dependencies
|
|
206
|
+
- [ ] Measures in dedicated folder or table
|
|
207
|
+
- [ ] Appropriate data types assigned
|
|
208
|
+
- [ ] Display folders organized
|
|
209
|
+
- [ ] Key columns properly indexed
|
|
210
|
+
|
|
211
|
+
## Anti-patterns to Avoid
|
|
212
|
+
|
|
213
|
+
### Wide Tables (Flat Files)
|
|
214
|
+
```
|
|
215
|
+
❌ One big table with everything
|
|
216
|
+
✓ Separate into facts and dimensions
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Snowflake Complexity
|
|
220
|
+
```
|
|
221
|
+
❌ Dim_Product → Dim_Category → Dim_Department
|
|
222
|
+
✓ Denormalize: Dim_Product (includes Category, Department)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Calculated Columns for Measures
|
|
226
|
+
```
|
|
227
|
+
❌ Calculated column: [Profit] = [Revenue] - [Cost]
|
|
228
|
+
✓ Measure: Profit = SUM([Revenue]) - SUM([Cost])
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Missing Date Dimension
|
|
232
|
+
```
|
|
233
|
+
❌ Using date column directly from fact table
|
|
234
|
+
✓ Proper Date dimension with all time intelligence attributes
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Complexity Adaptation
|
|
238
|
+
|
|
239
|
+
Adjust depth based on `config.json → experienceLevel`:
|
|
240
|
+
- **beginner**: Step-by-step with explanations, reference library examples
|
|
241
|
+
- **intermediate**: Standard depth, explain non-obvious decisions
|
|
242
|
+
- **advanced**: Concise, skip basics, focus on edge cases and optimization
|
|
243
|
+
|
|
244
|
+
## Related Skills
|
|
245
|
+
|
|
246
|
+
- `/data-model-design` — Interactive model builder
|
|
247
|
+
- `/dax` — Write measures for the model
|
|
248
|
+
- `/semantic-model` — Advanced semantic model patterns
|
|
249
|
+
- `/governance` — Naming conventions for model objects
|
|
250
|
+
|
|
251
|
+
## Related Resources
|
|
252
|
+
|
|
253
|
+
- [Snippets: Time Intelligence](../../snippets/dax/time-intelligence.md)
|
|
254
|
+
- [Templates: Data Models](../../templates/data-models/)
|