@luquimbo/bi-superpowers 3.1.1 → 3.2.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.
Files changed (107) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.claude-plugin/skill-manifest.json +1 -1
  4. package/.plugin/plugin.json +1 -1
  5. package/bin/build-plugin.js +6 -6
  6. package/bin/cli.js +169 -310
  7. package/bin/commands/install.js +87 -70
  8. package/bin/lib/agents.js +19 -0
  9. package/bin/lib/mcp-config.js +23 -4
  10. package/desktop-extension/manifest.json +4 -11
  11. package/desktop-extension/server.js +34 -25
  12. package/package.json +3 -9
  13. package/skills/pbi-connect/SKILL.md +1 -1
  14. package/skills/project-kickoff/SKILL.md +1 -1
  15. package/bin/commands/add.js +0 -533
  16. package/bin/commands/add.test.js +0 -77
  17. package/bin/commands/changelog.js +0 -443
  18. package/bin/commands/pull.js +0 -287
  19. package/bin/commands/pull.test.js +0 -36
  20. package/bin/commands/push.js +0 -231
  21. package/bin/commands/push.test.js +0 -14
  22. package/bin/commands/search.js +0 -344
  23. package/bin/commands/search.test.js +0 -115
  24. package/bin/commands/setup.js +0 -545
  25. package/bin/commands/setup.test.js +0 -46
  26. package/bin/commands/sync-profile.js +0 -405
  27. package/bin/commands/sync-profile.test.js +0 -14
  28. package/bin/commands/sync-source.js +0 -418
  29. package/bin/commands/sync-source.test.js +0 -14
  30. package/bin/utils/errors.js +0 -159
  31. package/bin/utils/git.js +0 -298
  32. package/bin/utils/logger.js +0 -142
  33. package/bin/utils/pbix.js +0 -305
  34. package/bin/utils/pbix.test.js +0 -37
  35. package/bin/utils/profiles.js +0 -312
  36. package/bin/utils/projects.js +0 -169
  37. package/bin/utils/readline.js +0 -206
  38. package/bin/utils/readline.test.js +0 -47
  39. package/docs/openrouter-free-models.md +0 -92
  40. package/library/examples/README.md +0 -151
  41. package/library/examples/finance-reporting/README.md +0 -351
  42. package/library/examples/finance-reporting/data-model.md +0 -267
  43. package/library/examples/finance-reporting/measures.dax +0 -557
  44. package/library/examples/hr-analytics/README.md +0 -371
  45. package/library/examples/hr-analytics/data-model.md +0 -315
  46. package/library/examples/hr-analytics/measures.dax +0 -460
  47. package/library/examples/marketing-analytics/README.md +0 -37
  48. package/library/examples/marketing-analytics/data-model.md +0 -62
  49. package/library/examples/marketing-analytics/measures.dax +0 -110
  50. package/library/examples/retail-analytics/README.md +0 -439
  51. package/library/examples/retail-analytics/data-model.md +0 -288
  52. package/library/examples/retail-analytics/measures.dax +0 -481
  53. package/library/examples/supply-chain/README.md +0 -37
  54. package/library/examples/supply-chain/data-model.md +0 -69
  55. package/library/examples/supply-chain/measures.dax +0 -77
  56. package/library/examples/udf-library/README.md +0 -228
  57. package/library/examples/udf-library/functions.dax +0 -571
  58. package/library/snippets/dax/README.md +0 -292
  59. package/library/snippets/dax/business-domains.md +0 -576
  60. package/library/snippets/dax/calculate-patterns.md +0 -276
  61. package/library/snippets/dax/calculation-groups.md +0 -489
  62. package/library/snippets/dax/error-handling.md +0 -495
  63. package/library/snippets/dax/iterators-and-aggregations.md +0 -474
  64. package/library/snippets/dax/kpis-and-metrics.md +0 -293
  65. package/library/snippets/dax/rankings-and-topn.md +0 -235
  66. package/library/snippets/dax/security-patterns.md +0 -413
  67. package/library/snippets/dax/text-and-formatting.md +0 -316
  68. package/library/snippets/dax/time-intelligence.md +0 -196
  69. package/library/snippets/dax/user-defined-functions.md +0 -477
  70. package/library/snippets/dax/virtual-tables.md +0 -546
  71. package/library/snippets/excel-formulas/README.md +0 -84
  72. package/library/snippets/excel-formulas/aggregations.md +0 -330
  73. package/library/snippets/excel-formulas/dates-and-times.md +0 -361
  74. package/library/snippets/excel-formulas/dynamic-arrays.md +0 -314
  75. package/library/snippets/excel-formulas/lookups.md +0 -169
  76. package/library/snippets/excel-formulas/text-functions.md +0 -363
  77. package/library/snippets/governance/naming-conventions.md +0 -97
  78. package/library/snippets/governance/review-checklists.md +0 -107
  79. package/library/snippets/power-query/README.md +0 -389
  80. package/library/snippets/power-query/api-integration.md +0 -707
  81. package/library/snippets/power-query/connections.md +0 -434
  82. package/library/snippets/power-query/data-cleaning.md +0 -298
  83. package/library/snippets/power-query/error-handling.md +0 -526
  84. package/library/snippets/power-query/parameters.md +0 -350
  85. package/library/snippets/power-query/performance.md +0 -506
  86. package/library/snippets/power-query/transformations.md +0 -330
  87. package/library/snippets/report-design/accessibility.md +0 -78
  88. package/library/snippets/report-design/chart-selection.md +0 -54
  89. package/library/snippets/report-design/layout-patterns.md +0 -87
  90. package/library/templates/data-models/README.md +0 -93
  91. package/library/templates/data-models/finance-model.md +0 -627
  92. package/library/templates/data-models/retail-star-schema.md +0 -473
  93. package/library/templates/excel/README.md +0 -83
  94. package/library/templates/excel/budget-tracker.md +0 -432
  95. package/library/templates/excel/data-entry-form.md +0 -533
  96. package/library/templates/power-bi/README.md +0 -72
  97. package/library/templates/power-bi/finance-report.md +0 -449
  98. package/library/templates/power-bi/kpi-scorecard.md +0 -461
  99. package/library/templates/power-bi/sales-dashboard.md +0 -281
  100. package/library/themes/excel/README.md +0 -436
  101. package/library/themes/power-bi/README.md +0 -271
  102. package/library/themes/power-bi/accessible.json +0 -307
  103. package/library/themes/power-bi/bi-superpowers-default.json +0 -858
  104. package/library/themes/power-bi/corporate-blue.json +0 -291
  105. package/library/themes/power-bi/dark-mode.json +0 -291
  106. package/library/themes/power-bi/minimal.json +0 -292
  107. package/library/themes/power-bi/print-friendly.json +0 -309
@@ -1,489 +0,0 @@
1
- # Calculation Groups in DAX
2
-
3
- Patterns for creating and using calculation groups for time intelligence, currency conversion, and measure formatting.
4
-
5
- ---
6
-
7
- ## What Are Calculation Groups?
8
-
9
- Calculation groups modify how measures are evaluated without changing the measures themselves. They're created in external tools (Tabular Editor, TMDL) and consist of:
10
-
11
- - **Calculation Group**: Container table
12
- - **Calculation Items**: Individual modifiers (e.g., YTD, PY, MTD)
13
- - **SELECTEDMEASURE()**: Reference to the measure being modified
14
-
15
- ---
16
-
17
- ## Time Intelligence Calculation Group
18
-
19
- ### Basic Time Intelligence Items
20
-
21
- ```dax
22
- // Calculation Group: Time Calculations
23
- // Column: Time Calculation
24
-
25
- // Item: Current
26
- SELECTEDMEASURE()
27
-
28
- // Item: YTD (Year-to-Date)
29
- CALCULATE(
30
- SELECTEDMEASURE(),
31
- DATESYTD('Date'[Date])
32
- )
33
-
34
- // Item: PY (Prior Year)
35
- CALCULATE(
36
- SELECTEDMEASURE(),
37
- SAMEPERIODLASTYEAR('Date'[Date])
38
- )
39
-
40
- // Item: YTD PY (Prior Year YTD)
41
- CALCULATE(
42
- SELECTEDMEASURE(),
43
- DATESYTD(SAMEPERIODLASTYEAR('Date'[Date]))
44
- )
45
-
46
- // Item: QTD (Quarter-to-Date)
47
- CALCULATE(
48
- SELECTEDMEASURE(),
49
- DATESQTD('Date'[Date])
50
- )
51
-
52
- // Item: MTD (Month-to-Date)
53
- CALCULATE(
54
- SELECTEDMEASURE(),
55
- DATESMTD('Date'[Date])
56
- )
57
-
58
- // Item: Rolling 12 Months
59
- CALCULATE(
60
- SELECTEDMEASURE(),
61
- DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH)
62
- )
63
-
64
- // Item: Rolling 3 Months
65
- CALCULATE(
66
- SELECTEDMEASURE(),
67
- DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -3, MONTH)
68
- )
69
- ```
70
-
71
- ### YoY Variance Items
72
-
73
- ```dax
74
- // Item: YoY Abs (Year-over-Year Absolute)
75
- VAR _Current = SELECTEDMEASURE()
76
- VAR _PY = CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))
77
- RETURN
78
- _Current - _PY
79
-
80
- // Item: YoY % (Year-over-Year Percentage)
81
- VAR _Current = SELECTEDMEASURE()
82
- VAR _PY = CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))
83
- RETURN
84
- DIVIDE(_Current - _PY, ABS(_PY))
85
-
86
- // Item: YTD YoY % (YTD Year-over-Year Percentage)
87
- VAR _CurrentYTD = CALCULATE(SELECTEDMEASURE(), DATESYTD('Date'[Date]))
88
- VAR _PYYTD = CALCULATE(SELECTEDMEASURE(), DATESYTD(SAMEPERIODLASTYEAR('Date'[Date])))
89
- RETURN
90
- DIVIDE(_CurrentYTD - _PYYTD, ABS(_PYYTD))
91
- ```
92
-
93
- ### Fiscal Year Time Intelligence
94
-
95
- ```dax
96
- // Item: FYTD (Fiscal Year-to-Date)
97
- // Assumes July 1 fiscal year start
98
- CALCULATE(
99
- SELECTEDMEASURE(),
100
- DATESYTD('Date'[Date], "6-30") // Fiscal year end
101
- )
102
-
103
- // Item: FY PY (Fiscal Prior Year)
104
- CALCULATE(
105
- SELECTEDMEASURE(),
106
- DATEADD('Date'[Date], -1, YEAR)
107
- )
108
- ```
109
-
110
- ---
111
-
112
- ## Currency Conversion Calculation Group
113
-
114
- ### Multi-Currency Items
115
-
116
- ```dax
117
- // Calculation Group: Currency
118
- // Column: Currency Display
119
-
120
- // Item: Local Currency
121
- SELECTEDMEASURE()
122
-
123
- // Item: USD
124
- VAR _Result = SELECTEDMEASURE()
125
- VAR _AvgRate = AVERAGE(DimCurrency[ToUSD_Rate])
126
- RETURN
127
- _Result * _AvgRate
128
-
129
- // Item: EUR
130
- VAR _Result = SELECTEDMEASURE()
131
- VAR _AvgRate = AVERAGE(DimCurrency[ToEUR_Rate])
132
- RETURN
133
- _Result * _AvgRate
134
-
135
- // Item: GBP
136
- VAR _Result = SELECTEDMEASURE()
137
- VAR _AvgRate = AVERAGE(DimCurrency[ToGBP_Rate])
138
- RETURN
139
- _Result * _AvgRate
140
- ```
141
-
142
- ### With Historical Rates
143
-
144
- ```dax
145
- // Item: USD (Historical Rate)
146
- SUMX(
147
- VALUES('Date'[Date]),
148
- VAR _DailyAmount = CALCULATE(SELECTEDMEASURE())
149
- VAR _DailyRate =
150
- CALCULATE(
151
- VALUES(DimExchangeRate[ToUSD]),
152
- DimExchangeRate[Date] = EARLIER('Date'[Date])
153
- )
154
- RETURN
155
- _DailyAmount * _DailyRate
156
- )
157
- ```
158
-
159
- ---
160
-
161
- ## Budget vs Actual Calculation Group
162
-
163
- ### Scenario Comparison Items
164
-
165
- ```dax
166
- // Calculation Group: Scenario Analysis
167
- // Column: Scenario
168
-
169
- // Item: Actual
170
- CALCULATE(
171
- SELECTEDMEASURE(),
172
- DimScenario[ScenarioName] = "Actual"
173
- )
174
-
175
- // Item: Budget
176
- CALCULATE(
177
- SELECTEDMEASURE(),
178
- DimScenario[ScenarioName] = "Budget"
179
- )
180
-
181
- // Item: Forecast
182
- CALCULATE(
183
- SELECTEDMEASURE(),
184
- DimScenario[ScenarioName] = "Forecast"
185
- )
186
-
187
- // Item: Variance (Actual - Budget)
188
- VAR _Actual = CALCULATE(SELECTEDMEASURE(), DimScenario[ScenarioName] = "Actual")
189
- VAR _Budget = CALCULATE(SELECTEDMEASURE(), DimScenario[ScenarioName] = "Budget")
190
- RETURN
191
- _Actual - _Budget
192
-
193
- // Item: Variance %
194
- VAR _Actual = CALCULATE(SELECTEDMEASURE(), DimScenario[ScenarioName] = "Actual")
195
- VAR _Budget = CALCULATE(SELECTEDMEASURE(), DimScenario[ScenarioName] = "Budget")
196
- RETURN
197
- DIVIDE(_Actual - _Budget, ABS(_Budget))
198
-
199
- // Item: Attainment %
200
- VAR _Actual = CALCULATE(SELECTEDMEASURE(), DimScenario[ScenarioName] = "Actual")
201
- VAR _Budget = CALCULATE(SELECTEDMEASURE(), DimScenario[ScenarioName] = "Budget")
202
- RETURN
203
- DIVIDE(_Actual, _Budget)
204
- ```
205
-
206
- ---
207
-
208
- ## Format String Calculation Group
209
-
210
- ### Dynamic Formatting Items
211
-
212
- ```dax
213
- // Calculation Group: Display Format
214
- // Column: Format
215
-
216
- // Item: Number
217
- SELECTEDMEASURE()
218
- // Format String: #,##0
219
-
220
- // Item: Currency
221
- SELECTEDMEASURE()
222
- // Format String: $#,##0
223
-
224
- // Item: Percent
225
- SELECTEDMEASURE()
226
- // Format String: 0.0%
227
-
228
- // Item: Thousands (K)
229
- DIVIDE(SELECTEDMEASURE(), 1000)
230
- // Format String: #,##0 K
231
-
232
- // Item: Millions (M)
233
- DIVIDE(SELECTEDMEASURE(), 1000000)
234
- // Format String: #,##0.0 M
235
-
236
- // Item: Billions (B)
237
- DIVIDE(SELECTEDMEASURE(), 1000000000)
238
- // Format String: #,##0.00 B
239
- ```
240
-
241
- ### Conditional Formatting
242
-
243
- ```dax
244
- // Item: Auto Scale
245
- VAR _Value = SELECTEDMEASURE()
246
- RETURN
247
- SWITCH(
248
- TRUE(),
249
- ABS(_Value) >= 1000000000, DIVIDE(_Value, 1000000000),
250
- ABS(_Value) >= 1000000, DIVIDE(_Value, 1000000),
251
- ABS(_Value) >= 1000, DIVIDE(_Value, 1000),
252
- _Value
253
- )
254
- // Dynamic format string (requires Tabular Editor 3):
255
- // "Auto" -- or implement via FORMAT in the item
256
- ```
257
-
258
- ---
259
-
260
- ## Advanced Patterns
261
-
262
- ### Moving Averages
263
-
264
- ```dax
265
- // Calculation Group: Moving Averages
266
- // Column: Moving Average
267
-
268
- // Item: Current
269
- SELECTEDMEASURE()
270
-
271
- // Item: 3-Month Moving Average
272
- AVERAGEX(
273
- DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -3, MONTH),
274
- CALCULATE(SELECTEDMEASURE())
275
- )
276
-
277
- // Item: 6-Month Moving Average
278
- AVERAGEX(
279
- DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -6, MONTH),
280
- CALCULATE(SELECTEDMEASURE())
281
- )
282
-
283
- // Item: 12-Month Moving Average
284
- AVERAGEX(
285
- DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH),
286
- CALCULATE(SELECTEDMEASURE())
287
- )
288
- ```
289
-
290
- ### Period-over-Period
291
-
292
- ```dax
293
- // Item: MoM (Month-over-Month)
294
- VAR _Current = SELECTEDMEASURE()
295
- VAR _PM = CALCULATE(SELECTEDMEASURE(), DATEADD('Date'[Date], -1, MONTH))
296
- RETURN
297
- _Current - _PM
298
-
299
- // Item: MoM %
300
- VAR _Current = SELECTEDMEASURE()
301
- VAR _PM = CALCULATE(SELECTEDMEASURE(), DATEADD('Date'[Date], -1, MONTH))
302
- RETURN
303
- DIVIDE(_Current - _PM, ABS(_PM))
304
-
305
- // Item: QoQ (Quarter-over-Quarter)
306
- VAR _Current = SELECTEDMEASURE()
307
- VAR _PQ = CALCULATE(SELECTEDMEASURE(), DATEADD('Date'[Date], -1, QUARTER))
308
- RETURN
309
- _Current - _PQ
310
-
311
- // Item: QoQ %
312
- VAR _Current = SELECTEDMEASURE()
313
- VAR _PQ = CALCULATE(SELECTEDMEASURE(), DATEADD('Date'[Date], -1, QUARTER))
314
- RETURN
315
- DIVIDE(_Current - _PQ, ABS(_PQ))
316
- ```
317
-
318
- ### Growth Rates
319
-
320
- ```dax
321
- // Item: CAGR (Compound Annual Growth Rate)
322
- VAR _StartValue =
323
- CALCULATE(
324
- SELECTEDMEASURE(),
325
- FIRSTDATE('Date'[Date])
326
- )
327
- VAR _EndValue =
328
- CALCULATE(
329
- SELECTEDMEASURE(),
330
- LASTDATE('Date'[Date])
331
- )
332
- VAR _Years =
333
- DATEDIFF(
334
- MIN('Date'[Date]),
335
- MAX('Date'[Date]),
336
- YEAR
337
- )
338
- RETURN
339
- IF(
340
- _Years > 0 && _StartValue > 0,
341
- POWER(DIVIDE(_EndValue, _StartValue), DIVIDE(1, _Years)) - 1,
342
- BLANK()
343
- )
344
- ```
345
-
346
- ---
347
-
348
- ## Multiple Calculation Groups
349
-
350
- ### Combining Time + Currency
351
-
352
- When you have multiple calculation groups, they compose:
353
-
354
- ```
355
- Revenue with "YTD" + "USD" =
356
- Revenue calculated YTD, then converted to USD
357
- ```
358
-
359
- **Order matters in Tabular Editor:**
360
- - Set precedence for each calculation group
361
- - Higher precedence applies outer (last)
362
-
363
- ```dax
364
- // If Time has precedence 10, Currency has precedence 20:
365
- // Currency(Time(SELECTEDMEASURE()))
366
-
367
- // The currency conversion wraps the time calculation
368
- ```
369
-
370
- ### Precedence Example
371
-
372
- ```
373
- Calculation Group: Time Intelligence (Precedence: 10)
374
- Calculation Group: Currency (Precedence: 20)
375
- Calculation Group: Format (Precedence: 30)
376
-
377
- Result: Format(Currency(Time(Measure)))
378
- ```
379
-
380
- ---
381
-
382
- ## Using in Reports
383
-
384
- ### Slicer on Calculation Group
385
-
386
- 1. Add calculation group column to slicer
387
- 2. User selects "YTD" or "PY"
388
- 3. All measures automatically adjust
389
-
390
- ### Matrix with Calculation Items
391
-
392
- | Product | Current | YTD | PY | YoY % |
393
- |---------|---------|-----|----|----- |
394
- | Widget A | 100K | 800K | 90K | 11% |
395
- | Widget B | 75K | 600K | 80K | -6% |
396
-
397
- ### Combining with Regular Measures
398
-
399
- ```dax
400
- // Measure that uses calculation group result
401
- Revenue with Time Calc =
402
- VAR _TimeCalc = SELECTEDVALUE('Time Calculations'[Time Calculation], "Current")
403
- RETURN
404
- SWITCH(
405
- _TimeCalc,
406
- "Current", [Revenue],
407
- "YTD", [Revenue YTD], // Explicit measure
408
- [Revenue] // Fallback
409
- )
410
- ```
411
-
412
- ---
413
-
414
- ## Best Practices
415
-
416
- ### 1. Name Items Clearly
417
-
418
- ```
419
- ✓ "YTD (Year-to-Date)"
420
- ✓ "PY (Prior Year)"
421
- ✓ "YoY % (Year-over-Year %)"
422
-
423
- ✗ "Calc1"
424
- ✗ "Time1"
425
- ```
426
-
427
- ### 2. Include "Current" Item
428
-
429
- ```dax
430
- // Always have a baseline item
431
- // Item: Current
432
- SELECTEDMEASURE()
433
- ```
434
-
435
- ### 3. Handle Blanks
436
-
437
- ```dax
438
- // Item: YoY % (with blank handling)
439
- VAR _Current = SELECTEDMEASURE()
440
- VAR _PY = CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))
441
- RETURN
442
- IF(
443
- ISBLANK(_PY) || _PY = 0,
444
- BLANK(),
445
- DIVIDE(_Current - _PY, ABS(_PY))
446
- )
447
- ```
448
-
449
- ### 4. Set Format Strings
450
-
451
- Each calculation item can have its own format string:
452
-
453
- | Item | Format String |
454
- |------|---------------|
455
- | Current | #,##0 |
456
- | YoY % | 0.0% |
457
- | YoY Abs | +#,##0;-#,##0;0 |
458
-
459
- ### 5. Test with Multiple Measures
460
-
461
- Calculation groups apply to ALL measures. Test with:
462
- - Sum measures (Revenue, Quantity)
463
- - Average measures (Avg Price)
464
- - Count measures (Customer Count)
465
- - Ratio measures (Margin %)
466
-
467
- ---
468
-
469
- ## Limitations
470
-
471
- | Limitation | Workaround |
472
- |------------|------------|
473
- | Cannot use with semi-additive measures (Avg, Distinct Count) without care | Create explicit measures for these |
474
- | Format strings limited in Power BI Desktop | Use Tabular Editor 3 |
475
- | No nested calculation groups | Set precedence carefully |
476
- | Can't reference another calc item | Use explicit measures |
477
-
478
- ---
479
-
480
- ## Setup Checklist
481
-
482
- - [ ] Identify repetitive time intelligence patterns
483
- - [ ] Create calculation group in Tabular Editor
484
- - [ ] Add calculation items with clear names
485
- - [ ] Set format strings for each item
486
- - [ ] Set precedence if multiple groups
487
- - [ ] Test with various measure types
488
- - [ ] Add slicer to report
489
- - [ ] Document for users