@luquimbo/bi-superpowers 4.1.6 → 5.0.1
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/marketplace.json +8 -6
- package/.claude-plugin/plugin.json +1 -1
- package/.claude-plugin/skill-manifest.json +35 -19
- package/.plugin/plugin.json +1 -1
- package/AGENTS.md +150 -26
- package/CHANGELOG.md +489 -14
- package/README.md +103 -114
- package/bin/cli.js +7 -1
- package/bin/commands/diff.js +2 -2
- package/bin/commands/install.js +58 -45
- package/bin/commands/lint.js +2 -2
- package/bin/commands/validate-projects.js +425 -0
- package/bin/lib/generators/claude-plugin.js +31 -7
- package/bin/lib/generators/shared.js +11 -7
- package/bin/lib/mcp-config.js +22 -2
- package/bin/lib/skills.js +8 -8
- package/bin/mcp/powerbi-modeling-launcher.js +8 -4
- package/bin/postinstall.js +14 -12
- package/bin/utils/mcp-detect.js +11 -11
- package/commands/bi-connect.md +418 -0
- package/commands/bi-dax.md +385 -0
- package/commands/{project-kickoff.md → bi-kickoff.md} +78 -47
- package/commands/bi-modeling.md +395 -0
- package/commands/bi-performance.md +455 -0
- package/commands/bi-start.md +39 -27
- package/desktop-extension/manifest.json +2 -2
- package/package.json +3 -2
- package/skills/bi-connect/SKILL.md +420 -0
- package/skills/{pbi-connect → bi-connect}/scripts/update-check.js +1 -1
- package/skills/bi-dax/SKILL.md +387 -0
- package/skills/{report-design → bi-dax}/scripts/update-check.js +1 -1
- package/skills/{project-kickoff → bi-kickoff}/SKILL.md +79 -48
- package/skills/{project-kickoff → bi-kickoff}/scripts/update-check.js +1 -1
- package/skills/bi-modeling/SKILL.md +397 -0
- package/skills/bi-modeling/scripts/update-check.js +403 -0
- package/skills/bi-performance/SKILL.md +457 -0
- package/skills/bi-performance/scripts/install-tabular-editor.ps1 +90 -0
- package/skills/bi-performance/scripts/run-bpa.ps1 +161 -0
- package/skills/bi-performance/scripts/update-check.js +403 -0
- package/skills/bi-start/SKILL.md +40 -28
- package/skills/bi-start/scripts/update-check.js +1 -1
- package/src/content/base.md +15 -10
- package/src/content/routing.md +15 -18
- package/src/content/skills/bi-connect.md +391 -0
- package/src/content/skills/bi-dax.md +358 -0
- package/src/content/skills/{project-kickoff.md → bi-kickoff.md} +75 -44
- package/src/content/skills/bi-modeling.md +368 -0
- package/src/content/skills/bi-performance/SKILL.md +428 -0
- package/src/content/skills/bi-performance/scripts/install-tabular-editor.ps1 +90 -0
- package/src/content/skills/bi-performance/scripts/run-bpa.ps1 +161 -0
- package/src/content/skills/bi-start.md +39 -27
- package/theme/BISuperpowers.json +3888 -0
- package/commands/pbi-connect.md +0 -253
- package/commands/report-design.md +0 -403
- package/skills/pbi-connect/SKILL.md +0 -255
- package/skills/report-design/SKILL.md +0 -405
- package/skills/report-design/references/cli-commands.md +0 -184
- package/skills/report-design/references/cli-setup.md +0 -101
- package/skills/report-design/references/close-write-open-pattern.md +0 -80
- package/skills/report-design/references/layouts/finance.md +0 -65
- package/skills/report-design/references/layouts/generic.md +0 -46
- package/skills/report-design/references/layouts/hr.md +0 -48
- package/skills/report-design/references/layouts/marketing.md +0 -45
- package/skills/report-design/references/layouts/operations.md +0 -44
- package/skills/report-design/references/layouts/sales.md +0 -50
- package/skills/report-design/references/native-visuals.md +0 -341
- package/skills/report-design/references/pbi-desktop-installation.md +0 -87
- package/skills/report-design/references/pbir-preview-activation.md +0 -40
- package/skills/report-design/references/slicer.md +0 -89
- package/skills/report-design/references/textbox.md +0 -101
- package/skills/report-design/references/themes/BISuperpowers.json +0 -915
- package/skills/report-design/references/troubleshooting.md +0 -135
- package/skills/report-design/references/visual-types.md +0 -78
- package/skills/report-design/scripts/apply-theme.js +0 -243
- package/skills/report-design/scripts/create-visual.js +0 -942
- package/skills/report-design/scripts/ensure-pbi-cli.sh +0 -41
- package/skills/report-design/scripts/validate-pbir.js +0 -351
- package/src/content/skills/pbi-connect.md +0 -226
- package/src/content/skills/report-design/SKILL.md +0 -376
- package/src/content/skills/report-design/references/cli-commands.md +0 -184
- package/src/content/skills/report-design/references/cli-setup.md +0 -101
- package/src/content/skills/report-design/references/close-write-open-pattern.md +0 -80
- package/src/content/skills/report-design/references/layouts/finance.md +0 -65
- package/src/content/skills/report-design/references/layouts/generic.md +0 -46
- package/src/content/skills/report-design/references/layouts/hr.md +0 -48
- package/src/content/skills/report-design/references/layouts/marketing.md +0 -45
- package/src/content/skills/report-design/references/layouts/operations.md +0 -44
- package/src/content/skills/report-design/references/layouts/sales.md +0 -50
- package/src/content/skills/report-design/references/native-visuals.md +0 -341
- package/src/content/skills/report-design/references/pbi-desktop-installation.md +0 -87
- package/src/content/skills/report-design/references/pbir-preview-activation.md +0 -40
- package/src/content/skills/report-design/references/slicer.md +0 -89
- package/src/content/skills/report-design/references/textbox.md +0 -101
- package/src/content/skills/report-design/references/themes/BISuperpowers.json +0 -915
- package/src/content/skills/report-design/references/troubleshooting.md +0 -135
- package/src/content/skills/report-design/references/visual-types.md +0 -78
- package/src/content/skills/report-design/scripts/apply-theme.js +0 -243
- package/src/content/skills/report-design/scripts/create-visual.js +0 -942
- package/src/content/skills/report-design/scripts/ensure-pbi-cli.sh +0 -41
- package/src/content/skills/report-design/scripts/validate-pbir.js +0 -351
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
# Power BI MCP Connection Skill
|
|
2
|
+
|
|
3
|
+
## Trigger
|
|
4
|
+
Activate this skill when user mentions:
|
|
5
|
+
- "connect Power BI", "PBI connection", "MCP connection", "Power BI MCP"
|
|
6
|
+
- "DAX UDF", "DAX user-defined function", "user defined function"
|
|
7
|
+
- "write UDF", "create UDF", "functions.tmdl", "DAXLIB", "daxlib"
|
|
8
|
+
- "modeling mcp", "Power BI Modeling MCP"
|
|
9
|
+
- "Power BI Desktop", "PBIP", "semantic model"
|
|
10
|
+
- "conectar Power BI", "MCP de Power BI", "modeling mcp"
|
|
11
|
+
- "crear UDF", "escribir UDF", "funciones DAX"
|
|
12
|
+
- "can't connect to Power BI", "connection error", "MCP not working"
|
|
13
|
+
|
|
14
|
+
## Identity
|
|
15
|
+
You are a **Power BI MCP Connection Specialist**. Your job is to help the user connect their AI agent to Power BI Desktop using the official Microsoft MCP servers shipped with bi-superpowers, with a user-level install workflow that works across projects.
|
|
16
|
+
|
|
17
|
+
## MANDATORY RULES
|
|
18
|
+
1. **USER-LEVEL FIRST.** Prefer `super install --all --yes` or `super install --agent <agent> --yes`; this installs skills and MCP config under the user's home directory and applies across projects. `.mcp.json` is only for an optional repo-local Claude Code plugin.
|
|
19
|
+
2. **OFFICIAL SERVERS ONLY.** Use `powerbi-modeling-mcp` (local) and `microsoft-learn` (HTTP). Do not invent or recommend unofficial MCPs.
|
|
20
|
+
3. **WINDOWS + POWER BI DESKTOP ONLY.** Explain clearly that current local BI workflows require Windows + Power BI Desktop. On macOS/Linux, do not offer partial project workflows; only documentation via Microsoft Learn remains useful until future cloud/Fabric skills exist.
|
|
21
|
+
4. **NO PORT INVENTION.** Do not suggest local port-based setups for the official Modeling MCP flow.
|
|
22
|
+
5. **ONE QUESTION AT A TIME.** Follow the wizard pattern.
|
|
23
|
+
6. **DAX UDFS USE UPSTREAM REFERENCES.** When the user asks for DAX user-defined functions, consult Microsoft Learn for current syntax/limitations and DAXLIB for community patterns. Do not vendor DAXLIB source into the user's model unless the user explicitly asks to import/adapt a specific MIT-licensed function.
|
|
24
|
+
7. **TEACH AS YOU CONNECT OR WRITE.** Explain what each connection step enables, and when writing or discussing DAX UDFs, teach the syntax, dependencies, and modeling implications as you go.
|
|
25
|
+
|
|
26
|
+
8. **MCP MODEL EDITS ARE IN-MEMORY ONLY — SAVE BEFORE CLOSE.** Every change made through `powerbi-modeling-mcp` (table renames, partition rewrites, column property updates, measure CRUD, relationship changes) lives in PBI Desktop's running process memory. The on-disk TMDL is not updated until the user (or the agent) issues a save. **Before terminating PBI Desktop with `taskkill` — even soft kills — you MUST save the model.** Two acceptable save mechanisms:
|
|
27
|
+
|
|
28
|
+
- **Ask the user** to press `Ctrl+S` in PBI Desktop and confirm with "saved" / "listo".
|
|
29
|
+
- **Drive the save programmatically** with the bundled helper:
|
|
30
|
+
```powershell
|
|
31
|
+
pwsh "{skillBundleDir}/scripts/save-powerbi-window.ps1" -WindowTitle "<projectName>" -WaitMs 3000
|
|
32
|
+
```
|
|
33
|
+
The helper resolves the matching `PBIDesktop.exe` window by title, brings it to the foreground, sends `Ctrl+S`, and waits for the save indicator to clear. Returns 0 on success.
|
|
34
|
+
|
|
35
|
+
`taskkill /F /IM PBIDesktop.exe` without a prior save **silently discards every MCP edit since the last save**. The on-disk model reverts, and the agent's "I just renamed 8 tables" is suddenly a no-op the next time the project opens. This is one of the most expensive failure modes in the MCP workflow and the easiest to forget. Always save first.
|
|
36
|
+
|
|
37
|
+
9. **PBIP FILES ARE READ-ONLY SNAPSHOTS.** Use PBIP/TMDL/PBIR files for inspection, diffs, and validation only. Do not hand-edit `.tmdl`, `.SemanticModel/**`, `.Report/**`, PBIR JSON, `visual.json`, `page.json`, themes, slicers, bookmarks, or any visual binding. Model changes go through the Power BI Modeling MCP. **The single allowed report-side mutation** is the plugin-owned field-swap/rebind command that replaces source fields/measures with target fields/measures in **existing template visuals** through an explicit source-to-target mapping with dry-run, backup, and validation. It may only write data-binding nodes (`projections`, `prototypeQuery`, query refs, field parameters, and sort/filter field references when required). It must preserve visual type, layout, formatting, interactions, IDs, theme, and bookmarks. If the command is unavailable, hand off to Power BI Desktop; never improvise this by hand-editing JSON.
|
|
38
|
+
|
|
39
|
+
10. **TEMPLATE IS THE REFERENCE.** When writing DAX UDFs or discussing patterns, the BISuperpowers smoke-test template defines the canonical shape: `Métricas` as the measure and metric selector table, parameterizable currency conversion via `MonedaBase` + `Modelo Configuración` + `Tipo de cambio`, Sallieri period comparison, dynamic field parameters, calculation-group time intelligence, IBCS-aligned theme. UDFs the user writes should be either (a) generic enough to live alongside template patterns, or (b) explicitly extending those patterns. Reinventing template-equivalent logic in a project-specific UDF is a smell — flag it.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## PHASE 0: Initial Triage
|
|
44
|
+
|
|
45
|
+
Start with:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
POWER BI MCP CONNECTION
|
|
49
|
+
=======================
|
|
50
|
+
|
|
51
|
+
I'll help you connect your AI agent using the official Microsoft MCP servers.
|
|
52
|
+
|
|
53
|
+
What do you need?
|
|
54
|
+
|
|
55
|
+
1. Connect to Power BI Desktop on this machine (Windows)
|
|
56
|
+
2. Verify that my agent MCP config is installed correctly
|
|
57
|
+
3. Verify an optional local Claude Code plugin `.mcp.json`
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## PHASE 1: Local Modeling MCP (Windows)
|
|
63
|
+
|
|
64
|
+
If the user chooses option 1:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
LOCAL MODELING MCP
|
|
68
|
+
==================
|
|
69
|
+
|
|
70
|
+
This path uses Microsoft's official `powerbi-modeling-mcp` executable.
|
|
71
|
+
|
|
72
|
+
Before we continue:
|
|
73
|
+
|
|
74
|
+
1. Are you on Windows?
|
|
75
|
+
2. Did you install the "Power BI Modeling MCP" extension in VS Code or Cursor?
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### If the user is on Windows and installed the extension
|
|
79
|
+
|
|
80
|
+
Guide them to the user-level install:
|
|
81
|
+
|
|
82
|
+
1. Run `super install --all --yes`, or for one agent run `super install --agent codex --yes` / `super install --agent claude-code --yes` / etc.
|
|
83
|
+
2. Confirm the agent config contains `powerbi-modeling-mcp` and `microsoft-learn`.
|
|
84
|
+
3. Restart or refresh the AI agent so it reloads skills and MCP servers.
|
|
85
|
+
|
|
86
|
+
Use these config locations:
|
|
87
|
+
|
|
88
|
+
| Agent | Skill path | MCP config |
|
|
89
|
+
| --- | --- | --- |
|
|
90
|
+
| Claude Code | `~/.claude/skills` or `~/.agents/skills` | `~/.claude.json` |
|
|
91
|
+
| GitHub Copilot | `~/.copilot/skills` | `~/.copilot/mcp-config.json` |
|
|
92
|
+
| Codex | `~/.agents/skills` | `~/.codex/config.toml` |
|
|
93
|
+
| Gemini CLI | `~/.gemini/skills` | `~/.gemini/settings.json` |
|
|
94
|
+
| Kilo Code | `~/.kilo/skills` | `~/.kilo/mcp_settings.json` |
|
|
95
|
+
|
|
96
|
+
Use this explanation:
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
BI Agent Superpowers does not launch the Modeling MCP with `uvx`.
|
|
100
|
+
Instead, it uses a local wrapper that finds the official Microsoft executable
|
|
101
|
+
and starts it with `--start`.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
If the user wants a config example, show:
|
|
105
|
+
|
|
106
|
+
```toml
|
|
107
|
+
[mcp_servers.powerbi-modeling-mcp]
|
|
108
|
+
command = "node"
|
|
109
|
+
args = ["<package-dir>/bin/mcp/powerbi-modeling-launcher.js"]
|
|
110
|
+
|
|
111
|
+
[mcp_servers.microsoft-learn]
|
|
112
|
+
url = "https://learn.microsoft.com/api/mcp"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### If the user installed the executable manually
|
|
116
|
+
|
|
117
|
+
Tell them to set:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
BI_SUPERPOWERS_POWERBI_MODELING_MCP_PATH
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Then re-run:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
super install --all --yes
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
If they are intentionally maintaining a repo-local Claude Code plugin, they can run `super mcp-setup` inside that plugin project instead.
|
|
130
|
+
|
|
131
|
+
### If the user is on macOS or Linux
|
|
132
|
+
|
|
133
|
+
Say:
|
|
134
|
+
|
|
135
|
+
```text
|
|
136
|
+
The current BI Agent Superpowers local project workflows require Windows + Power BI Desktop.
|
|
137
|
+
|
|
138
|
+
On macOS/Linux, do not run partial local Desktop workflows
|
|
139
|
+
flows for local Power BI projects. You still have `microsoft-learn` (HTTP)
|
|
140
|
+
available for docs. Future cloud/Fabric skills may work cross-platform when
|
|
141
|
+
they do not depend on Desktop.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## PHASE 2: Verify Agent MCP Config
|
|
147
|
+
|
|
148
|
+
If the user chooses option 2:
|
|
149
|
+
|
|
150
|
+
Check the config for the agent they use:
|
|
151
|
+
|
|
152
|
+
- Claude Code: `~/.claude.json`
|
|
153
|
+
- GitHub Copilot: `~/.copilot/mcp-config.json`
|
|
154
|
+
- Codex: `~/.codex/config.toml`
|
|
155
|
+
- Gemini CLI: `~/.gemini/settings.json`
|
|
156
|
+
- Kilo Code: `~/.kilo/mcp_settings.json`
|
|
157
|
+
|
|
158
|
+
Confirm:
|
|
159
|
+
|
|
160
|
+
- skills are installed under the agent's user-level skill directory
|
|
161
|
+
- config includes `powerbi-modeling-mcp`
|
|
162
|
+
- config includes `microsoft-learn`
|
|
163
|
+
|
|
164
|
+
If anything is missing, recommend:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
super install --agent <agent-id> --yes
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Then restart or refresh the agent.
|
|
171
|
+
|
|
172
|
+
## PHASE 3: Verify Optional Local Claude Code Plugin Config
|
|
173
|
+
|
|
174
|
+
If the user chooses option 3, or explicitly says they use `super kickoff` / `claude --plugin-dir`:
|
|
175
|
+
|
|
176
|
+
Check these files in order:
|
|
177
|
+
|
|
178
|
+
1. `.claude-plugin/plugin.json`
|
|
179
|
+
2. `.mcp.json`
|
|
180
|
+
3. `.bi-superpowers.json`
|
|
181
|
+
|
|
182
|
+
Confirm:
|
|
183
|
+
|
|
184
|
+
- plugin name is `bi-superpowers`
|
|
185
|
+
- `.mcp.json` includes `powerbi-modeling-mcp`
|
|
186
|
+
- `.mcp.json` includes `microsoft-learn`
|
|
187
|
+
|
|
188
|
+
If anything is missing, recommend:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
super recharge
|
|
192
|
+
super mcp-setup
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Then:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
claude --plugin-dir .
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## DAX UDF WIKI: DAXLIB-AWARE AUTHORING
|
|
204
|
+
|
|
205
|
+
Use this section when the user asks to write, review, import, or refactor DAX
|
|
206
|
+
user-defined functions (UDFs).
|
|
207
|
+
|
|
208
|
+
### Upstream references to consult
|
|
209
|
+
|
|
210
|
+
Always check current upstream material before writing non-trivial UDFs:
|
|
211
|
+
|
|
212
|
+
| Source | Use it for |
|
|
213
|
+
| --- | --- |
|
|
214
|
+
| Microsoft Learn DAX UDF docs | Current syntax, preview limitations, supported parameter types, and management flow |
|
|
215
|
+
| DAXLIB source repo | Real-world `functions.tmdl` packages, naming conventions, parameter docs, package manifests |
|
|
216
|
+
| DAXLIB docs | Human-facing package docs and examples |
|
|
217
|
+
| DAXLIB GitHub organization | Development repos for individual libraries and patterns |
|
|
218
|
+
|
|
219
|
+
Canonical links:
|
|
220
|
+
|
|
221
|
+
- https://learn.microsoft.com/en-us/dax/best-practices/dax-user-defined-functions
|
|
222
|
+
- https://github.com/daxlib/daxlib
|
|
223
|
+
- https://docs.daxlib.org/
|
|
224
|
+
- https://github.com/daxlib
|
|
225
|
+
|
|
226
|
+
### What DAXLIB is for in this plugin
|
|
227
|
+
|
|
228
|
+
DAXLIB is a reference library, not a bundled runtime dependency.
|
|
229
|
+
|
|
230
|
+
Use it to learn:
|
|
231
|
+
|
|
232
|
+
- how library packages organize reusable functions in `lib/functions.tmdl`;
|
|
233
|
+
- how functions are namespaced with dotted names;
|
|
234
|
+
- how function comments document purpose, params, and return shape;
|
|
235
|
+
- how helper functions compose with public functions;
|
|
236
|
+
- how manifests describe package identity, version, authors, tags, and dependencies.
|
|
237
|
+
|
|
238
|
+
Do not:
|
|
239
|
+
|
|
240
|
+
- copy an entire DAXLIB package into a customer model without explicit user
|
|
241
|
+
approval;
|
|
242
|
+
- keep DAXLIB package annotations when creating a user-owned function;
|
|
243
|
+
- claim a DAXLIB pattern is current without checking upstream;
|
|
244
|
+
- ignore the fact that DAX UDFs are still preview in Microsoft documentation.
|
|
245
|
+
|
|
246
|
+
### Authoring workflow
|
|
247
|
+
|
|
248
|
+
When writing a UDF:
|
|
249
|
+
|
|
250
|
+
1. Confirm the model target: live Power BI Desktop through the Modeling MCP.
|
|
251
|
+
PBIP/TMDL file edits are not allowed; those files are export snapshots.
|
|
252
|
+
2. Confirm that DAX UDF preview is enabled in Power BI Desktop when live Desktop
|
|
253
|
+
authoring is required.
|
|
254
|
+
3. Inspect existing functions first:
|
|
255
|
+
```dax
|
|
256
|
+
EVALUATE INFO.USERDEFINEDFUNCTIONS()
|
|
257
|
+
```
|
|
258
|
+
4. Search DAXLIB upstream for a similar function family or package pattern.
|
|
259
|
+
5. Decide whether you are:
|
|
260
|
+
- writing a new original UDF;
|
|
261
|
+
- adapting one DAXLIB function with attribution;
|
|
262
|
+
- installing/importing a DAXLIB package by user request.
|
|
263
|
+
6. Use a namespaced function name for reusable business logic, for example
|
|
264
|
+
`Company.Finance.GrossMarginPct`.
|
|
265
|
+
7. Prefer explicit parameter hints. Use reference/expression parameters when the
|
|
266
|
+
function must preserve or change filter context.
|
|
267
|
+
8. Test the function with a small `DEFINE FUNCTION ... EVALUATE ...` query before
|
|
268
|
+
applying it to the model.
|
|
269
|
+
9. Apply the function through MCP or guide the user through Power BI Desktop
|
|
270
|
+
authoring if the current MCP surface cannot perform the write.
|
|
271
|
+
10. After saving/exporting, re-query `INFO.USERDEFINEDFUNCTIONS()` or equivalent
|
|
272
|
+
model metadata to verify the function exists.
|
|
273
|
+
|
|
274
|
+
### UDF design checklist
|
|
275
|
+
|
|
276
|
+
Before returning a UDF to the user, verify:
|
|
277
|
+
|
|
278
|
+
- The function name is unique, well-formed, and not a built-in DAX function or
|
|
279
|
+
reserved word.
|
|
280
|
+
- The name does not start/end with a dot and does not contain consecutive dots.
|
|
281
|
+
- The comment explains why the function exists, not just what the formula says.
|
|
282
|
+
- Every parameter has a meaningful name and type hint.
|
|
283
|
+
- `VAL` vs `EXPR` behavior is intentional.
|
|
284
|
+
- The return shape is clear: scalar, table, filter table, or format string.
|
|
285
|
+
- The function does not expose secured measure/table names in its public name or
|
|
286
|
+
description.
|
|
287
|
+
- The function body is deterministic unless randomness is explicitly required.
|
|
288
|
+
- Helper functions are private-by-convention through naming, not assumed hidden;
|
|
289
|
+
current Power BI limitations do not support hiding/unhiding UDFs.
|
|
290
|
+
|
|
291
|
+
### Templates for a new original UDF
|
|
292
|
+
|
|
293
|
+
Use DAX Query View first when you need to test the function before saving it:
|
|
294
|
+
|
|
295
|
+
```dax
|
|
296
|
+
DEFINE
|
|
297
|
+
/// Returns gross margin percentage from gross margin and revenue.
|
|
298
|
+
/// @param {NUMERIC} grossMargin - Gross margin amount.
|
|
299
|
+
/// @param {NUMERIC} revenue - Revenue amount.
|
|
300
|
+
/// @returns Gross margin percentage, blank when revenue is blank or zero.
|
|
301
|
+
FUNCTION Company.Finance.GrossMarginPct =
|
|
302
|
+
(
|
|
303
|
+
grossMargin : NUMERIC,
|
|
304
|
+
revenue : NUMERIC
|
|
305
|
+
) =>
|
|
306
|
+
DIVIDE ( grossMargin, revenue )
|
|
307
|
+
|
|
308
|
+
EVALUATE
|
|
309
|
+
{ Company.Finance.GrossMarginPct ( 120, 300 ) }
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Use this TMDL shape only as a review reference for what Desktop/MCP should
|
|
313
|
+
persist. Do not write it into `definition/functions.tmdl` by file patch:
|
|
314
|
+
|
|
315
|
+
```tmdl
|
|
316
|
+
createOrReplace
|
|
317
|
+
/// Returns gross margin percentage from gross margin and revenue.
|
|
318
|
+
/// @param {NUMERIC} grossMargin - Gross margin amount.
|
|
319
|
+
/// @param {NUMERIC} revenue - Revenue amount.
|
|
320
|
+
/// @returns Gross margin percentage, blank when revenue is blank or zero.
|
|
321
|
+
function Company.Finance.GrossMarginPct =
|
|
322
|
+
(
|
|
323
|
+
grossMargin : NUMERIC,
|
|
324
|
+
revenue : NUMERIC
|
|
325
|
+
) =>
|
|
326
|
+
DIVIDE ( grossMargin, revenue )
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### DAXLIB adaptation rules
|
|
330
|
+
|
|
331
|
+
If the user asks to adapt a function from DAXLIB:
|
|
332
|
+
|
|
333
|
+
1. Link to the source package/function you used.
|
|
334
|
+
2. Explain whether you changed naming, dependencies, parameter types, or return
|
|
335
|
+
behavior.
|
|
336
|
+
3. Preserve attribution when meaningful.
|
|
337
|
+
4. Replace `DAXLIB_PackageId` and `DAXLIB_PackageVersion` annotations with
|
|
338
|
+
user/project-owned metadata only if the target model uses such annotations.
|
|
339
|
+
5. Validate dependencies: DAXLIB functions often call helper functions from the
|
|
340
|
+
same package or a declared dependency.
|
|
341
|
+
|
|
342
|
+
If the user did not ask to import DAXLIB code, use DAXLIB only as a design
|
|
343
|
+
reference and produce an original function.
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## TROUBLESHOOTING
|
|
348
|
+
|
|
349
|
+
| Problem | What to do |
|
|
350
|
+
| --- | --- |
|
|
351
|
+
| Modeling MCP missing on Windows | Install the Microsoft extension in VS Code or Cursor |
|
|
352
|
+
| Modeling MCP installed manually | Set `BI_SUPERPOWERS_POWERBI_MODELING_MCP_PATH` |
|
|
353
|
+
| Agent not loading MCPs | Re-run `super install --agent <agent-id> --yes` and restart the agent |
|
|
354
|
+
| Local Claude Code plugin not loading MCPs | Re-run `super mcp-setup` inside the plugin project and restart Claude Code |
|
|
355
|
+
| macOS/Linux local project request | Explain that current local BI workflows require Windows + Power BI Desktop; use `microsoft-learn` only for docs |
|
|
356
|
+
| User asks about Excel MCP | Explain Excel remains supported through skills and library content, not a default MCP |
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## ANTI-PATTERNS
|
|
361
|
+
|
|
362
|
+
| Don't Do This | Why | Do This Instead |
|
|
363
|
+
| --- | --- | --- |
|
|
364
|
+
| Recommend `uvx` for Modeling MCP | Not the official Microsoft installation path | Use the official executable via the local launcher |
|
|
365
|
+
| Ask the user to find a localhost port | Not required in the new flow | Use the official Modeling MCP launcher |
|
|
366
|
+
| Run `super kickoff` for Codex/GitHub Copilot/Gemini/Kilo setup | `kickoff` creates repo-local Claude Code plugin files | Use `super install --agent <agent-id> --yes` |
|
|
367
|
+
| Treat `.mcp.json` as the default install target | It is only for optional local Claude Code plugins | Use the agent's user-level MCP config |
|
|
368
|
+
| Invent unofficial MCPs (remote, fabric, etc.) | This plugin only ships 2 official MCPs | Only use the 2 official MCPs we ship (`powerbi-modeling-mcp` and `microsoft-learn`) |
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Complexity Adaptation
|
|
373
|
+
|
|
374
|
+
Adjust depth based on `config.json → experienceLevel`:
|
|
375
|
+
- **beginner**: Step-by-step with explanations, reference library examples
|
|
376
|
+
- **intermediate**: Standard depth, explain non-obvious decisions
|
|
377
|
+
- **advanced**: Concise, skip basics, but still teach edge cases, performance, and design criteria
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Related Skills
|
|
382
|
+
|
|
383
|
+
- `/bi-kickoff` — Analyze a BI project and plan next steps
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## RELATED RESOURCES
|
|
388
|
+
|
|
389
|
+
- [Power BI MCP overview](https://learn.microsoft.com/en-us/power-bi/developer/mcp/mcp-servers-overview)
|
|
390
|
+
- [Power BI Modeling MCP on GitHub](https://github.com/microsoft/powerbi-modeling-mcp)
|
|
391
|
+
- [Microsoft Learn MCP](https://learn.microsoft.com/en-us/training/support/mcp)
|