@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,330 @@
|
|
|
1
|
+
# Data Transformation Power Query Patterns
|
|
2
|
+
|
|
3
|
+
Reusable M code for reshaping and transforming data.
|
|
4
|
+
|
|
5
|
+
## Unpivot Operations
|
|
6
|
+
|
|
7
|
+
### Unpivot Selected Columns
|
|
8
|
+
```m
|
|
9
|
+
let
|
|
10
|
+
Source = YourSource,
|
|
11
|
+
// Unpivot month columns into rows
|
|
12
|
+
Unpivoted = Table.UnpivotOtherColumns(
|
|
13
|
+
Source,
|
|
14
|
+
{"Product", "Region"}, // Columns to keep
|
|
15
|
+
"Month", // New attribute column name
|
|
16
|
+
"Sales" // New value column name
|
|
17
|
+
)
|
|
18
|
+
in
|
|
19
|
+
Unpivoted
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Unpivot Only Selected Columns
|
|
23
|
+
```m
|
|
24
|
+
let
|
|
25
|
+
Source = YourSource,
|
|
26
|
+
Unpivoted = Table.Unpivot(
|
|
27
|
+
Source,
|
|
28
|
+
{"Jan", "Feb", "Mar", "Apr", "May", "Jun"},
|
|
29
|
+
"Month",
|
|
30
|
+
"Value"
|
|
31
|
+
)
|
|
32
|
+
in
|
|
33
|
+
Unpivoted
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Dynamic Unpivot (All Numeric Columns)
|
|
37
|
+
```m
|
|
38
|
+
let
|
|
39
|
+
Source = YourSource,
|
|
40
|
+
NumericColumns = List.Select(
|
|
41
|
+
Table.ColumnNames(Source),
|
|
42
|
+
each Type.Is(Value.Type(Table.Column(Source, _){0}?), Number.Type)
|
|
43
|
+
),
|
|
44
|
+
Unpivoted = Table.Unpivot(Source, NumericColumns, "Metric", "Value")
|
|
45
|
+
in
|
|
46
|
+
Unpivoted
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Pivot Operations
|
|
50
|
+
|
|
51
|
+
### Basic Pivot
|
|
52
|
+
```m
|
|
53
|
+
let
|
|
54
|
+
Source = YourSource,
|
|
55
|
+
Pivoted = Table.Pivot(
|
|
56
|
+
Source,
|
|
57
|
+
List.Distinct(Source[Category]),
|
|
58
|
+
"Category",
|
|
59
|
+
"Amount",
|
|
60
|
+
List.Sum
|
|
61
|
+
)
|
|
62
|
+
in
|
|
63
|
+
Pivoted
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Pivot with Multiple Aggregations
|
|
67
|
+
```m
|
|
68
|
+
let
|
|
69
|
+
Source = YourSource,
|
|
70
|
+
// First get sum
|
|
71
|
+
PivotSum = Table.Pivot(
|
|
72
|
+
Source,
|
|
73
|
+
List.Distinct(Source[Year]),
|
|
74
|
+
"Year",
|
|
75
|
+
"Amount",
|
|
76
|
+
List.Sum
|
|
77
|
+
),
|
|
78
|
+
// Rename to indicate sum
|
|
79
|
+
RenamedSum = Table.TransformColumnNames(
|
|
80
|
+
PivotSum,
|
|
81
|
+
each if Text.Contains(_, "20") then _ & "_Sum" else _
|
|
82
|
+
)
|
|
83
|
+
in
|
|
84
|
+
RenamedSum
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Split and Combine
|
|
88
|
+
|
|
89
|
+
### Split Column by Delimiter
|
|
90
|
+
```m
|
|
91
|
+
let
|
|
92
|
+
Source = YourSource,
|
|
93
|
+
Split = Table.SplitColumn(
|
|
94
|
+
Source,
|
|
95
|
+
"FullName",
|
|
96
|
+
Splitter.SplitTextByDelimiter(" ", QuoteStyle.None),
|
|
97
|
+
{"FirstName", "LastName"}
|
|
98
|
+
)
|
|
99
|
+
in
|
|
100
|
+
Split
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Split into Rows
|
|
104
|
+
```m
|
|
105
|
+
let
|
|
106
|
+
Source = YourSource,
|
|
107
|
+
// Split comma-separated values into rows
|
|
108
|
+
SplitToRows = Table.ExpandListColumn(
|
|
109
|
+
Table.TransformColumns(
|
|
110
|
+
Source,
|
|
111
|
+
{{"Tags", each Text.Split(_, ","), type list}}
|
|
112
|
+
),
|
|
113
|
+
"Tags"
|
|
114
|
+
)
|
|
115
|
+
in
|
|
116
|
+
SplitToRows
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Combine Columns
|
|
120
|
+
```m
|
|
121
|
+
let
|
|
122
|
+
Source = YourSource,
|
|
123
|
+
Combined = Table.CombineColumns(
|
|
124
|
+
Source,
|
|
125
|
+
{"FirstName", "LastName"},
|
|
126
|
+
Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),
|
|
127
|
+
"FullName"
|
|
128
|
+
)
|
|
129
|
+
in
|
|
130
|
+
Combined
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Conditional Columns
|
|
134
|
+
|
|
135
|
+
### If Then Else
|
|
136
|
+
```m
|
|
137
|
+
let
|
|
138
|
+
Source = YourSource,
|
|
139
|
+
AddCategory = Table.AddColumn(
|
|
140
|
+
Source,
|
|
141
|
+
"SizeCategory",
|
|
142
|
+
each if [Amount] > 10000 then "Large"
|
|
143
|
+
else if [Amount] > 1000 then "Medium"
|
|
144
|
+
else "Small",
|
|
145
|
+
type text
|
|
146
|
+
)
|
|
147
|
+
in
|
|
148
|
+
AddCategory
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Switch Pattern
|
|
152
|
+
```m
|
|
153
|
+
let
|
|
154
|
+
Source = YourSource,
|
|
155
|
+
AddRegion = Table.AddColumn(
|
|
156
|
+
Source,
|
|
157
|
+
"Region",
|
|
158
|
+
each
|
|
159
|
+
let
|
|
160
|
+
state = [State]
|
|
161
|
+
in
|
|
162
|
+
if List.Contains({"CA", "OR", "WA"}, state) then "West"
|
|
163
|
+
else if List.Contains({"NY", "NJ", "CT"}, state) then "East"
|
|
164
|
+
else if List.Contains({"TX", "FL", "GA"}, state) then "South"
|
|
165
|
+
else "Central",
|
|
166
|
+
type text
|
|
167
|
+
)
|
|
168
|
+
in
|
|
169
|
+
AddRegion
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Lookup from Another Table
|
|
173
|
+
```m
|
|
174
|
+
let
|
|
175
|
+
Source = YourSource,
|
|
176
|
+
Lookup = LookupTable,
|
|
177
|
+
Merged = Table.NestedJoin(
|
|
178
|
+
Source,
|
|
179
|
+
{"ProductID"},
|
|
180
|
+
Lookup,
|
|
181
|
+
{"ProductID"},
|
|
182
|
+
"LookupData",
|
|
183
|
+
JoinKind.LeftOuter
|
|
184
|
+
),
|
|
185
|
+
Expanded = Table.ExpandTableColumn(
|
|
186
|
+
Merged,
|
|
187
|
+
"LookupData",
|
|
188
|
+
{"Category", "Subcategory"}
|
|
189
|
+
)
|
|
190
|
+
in
|
|
191
|
+
Expanded
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Grouping and Aggregation
|
|
195
|
+
|
|
196
|
+
### Basic Group By
|
|
197
|
+
```m
|
|
198
|
+
let
|
|
199
|
+
Source = YourSource,
|
|
200
|
+
Grouped = Table.Group(
|
|
201
|
+
Source,
|
|
202
|
+
{"Category"},
|
|
203
|
+
{
|
|
204
|
+
{"TotalSales", each List.Sum([Amount]), type number},
|
|
205
|
+
{"AvgSales", each List.Average([Amount]), type number},
|
|
206
|
+
{"Count", each Table.RowCount(_), Int64.Type}
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
in
|
|
210
|
+
Grouped
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Group with All Rows
|
|
214
|
+
```m
|
|
215
|
+
let
|
|
216
|
+
Source = YourSource,
|
|
217
|
+
Grouped = Table.Group(
|
|
218
|
+
Source,
|
|
219
|
+
{"CustomerID"},
|
|
220
|
+
{
|
|
221
|
+
{"AllOrders", each _, type table},
|
|
222
|
+
{"FirstOrder", each List.Min([OrderDate]), type date},
|
|
223
|
+
{"LastOrder", each List.Max([OrderDate]), type date},
|
|
224
|
+
{"TotalSpent", each List.Sum([Amount]), type number}
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
in
|
|
228
|
+
Grouped
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Running Total
|
|
232
|
+
```m
|
|
233
|
+
let
|
|
234
|
+
Source = YourSource,
|
|
235
|
+
Sorted = Table.Sort(Source, {{"Date", Order.Ascending}}),
|
|
236
|
+
Indexed = Table.AddIndexColumn(Sorted, "Index", 1, 1, Int64.Type),
|
|
237
|
+
RunningTotal = Table.AddColumn(
|
|
238
|
+
Indexed,
|
|
239
|
+
"RunningTotal",
|
|
240
|
+
each List.Sum(List.FirstN(Sorted[Amount], [Index])),
|
|
241
|
+
type number
|
|
242
|
+
)
|
|
243
|
+
in
|
|
244
|
+
RunningTotal
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Date Transformations
|
|
248
|
+
|
|
249
|
+
### Extract Date Parts
|
|
250
|
+
```m
|
|
251
|
+
let
|
|
252
|
+
Source = YourSource,
|
|
253
|
+
AddDateParts = Table.AddColumn(
|
|
254
|
+
Table.AddColumn(
|
|
255
|
+
Table.AddColumn(
|
|
256
|
+
Table.AddColumn(Source, "Year", each Date.Year([Date]), Int64.Type),
|
|
257
|
+
"Month", each Date.Month([Date]), Int64.Type
|
|
258
|
+
),
|
|
259
|
+
"MonthName", each Date.MonthName([Date]), type text
|
|
260
|
+
),
|
|
261
|
+
"Quarter", each Date.QuarterOfYear([Date]), Int64.Type
|
|
262
|
+
)
|
|
263
|
+
in
|
|
264
|
+
AddDateParts
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Create Date Table
|
|
268
|
+
```m
|
|
269
|
+
let
|
|
270
|
+
StartDate = #date(2020, 1, 1),
|
|
271
|
+
EndDate = #date(2025, 12, 31),
|
|
272
|
+
DateList = List.Dates(StartDate, Duration.Days(EndDate - StartDate) + 1, #duration(1, 0, 0, 0)),
|
|
273
|
+
DateTable = Table.FromList(DateList, Splitter.SplitByNothing(), {"Date"}, null, ExtraValues.Error),
|
|
274
|
+
TypedDate = Table.TransformColumnTypes(DateTable, {{"Date", type date}}),
|
|
275
|
+
AddColumns = Table.AddColumn(
|
|
276
|
+
Table.AddColumn(
|
|
277
|
+
Table.AddColumn(
|
|
278
|
+
Table.AddColumn(
|
|
279
|
+
Table.AddColumn(TypedDate, "Year", each Date.Year([Date]), Int64.Type),
|
|
280
|
+
"Month", each Date.Month([Date]), Int64.Type
|
|
281
|
+
),
|
|
282
|
+
"MonthName", each Date.MonthName([Date]), type text
|
|
283
|
+
),
|
|
284
|
+
"Quarter", each "Q" & Text.From(Date.QuarterOfYear([Date])), type text
|
|
285
|
+
),
|
|
286
|
+
"DayOfWeek", each Date.DayOfWeekName([Date]), type text
|
|
287
|
+
)
|
|
288
|
+
in
|
|
289
|
+
AddColumns
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Cross Join and Append
|
|
293
|
+
|
|
294
|
+
### Cross Join
|
|
295
|
+
```m
|
|
296
|
+
let
|
|
297
|
+
Table1 = YourTable1,
|
|
298
|
+
Table2 = YourTable2,
|
|
299
|
+
CrossJoin = Table.AddColumn(
|
|
300
|
+
Table1,
|
|
301
|
+
"Table2",
|
|
302
|
+
each Table2
|
|
303
|
+
),
|
|
304
|
+
Expanded = Table.ExpandTableColumn(
|
|
305
|
+
CrossJoin,
|
|
306
|
+
"Table2",
|
|
307
|
+
Table.ColumnNames(Table2)
|
|
308
|
+
)
|
|
309
|
+
in
|
|
310
|
+
Expanded
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Append Multiple Tables
|
|
314
|
+
```m
|
|
315
|
+
let
|
|
316
|
+
Table1 = Source1,
|
|
317
|
+
Table2 = Source2,
|
|
318
|
+
Table3 = Source3,
|
|
319
|
+
Appended = Table.Combine({Table1, Table2, Table3})
|
|
320
|
+
in
|
|
321
|
+
Appended
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Usage Notes
|
|
325
|
+
|
|
326
|
+
- Always consider query folding for database sources
|
|
327
|
+
- Test transformations with sample data first
|
|
328
|
+
- Use Table.Buffer() when needed for performance
|
|
329
|
+
- Document complex transformations with comments
|
|
330
|
+
- Prefer built-in functions over custom logic when possible
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Accessibility Guidelines for Power BI Reports
|
|
2
|
+
|
|
3
|
+
Ensure reports meet WCAG 2.1 AA standards and work for all users.
|
|
4
|
+
|
|
5
|
+
## Color Accessibility
|
|
6
|
+
|
|
7
|
+
### Color-Blind Safe Palettes
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"accessible-categorical": [
|
|
12
|
+
"#0072B2", "#E69F00", "#009E73",
|
|
13
|
+
"#F0E442", "#56B4E9", "#D55E00",
|
|
14
|
+
"#CC79A7", "#000000"
|
|
15
|
+
],
|
|
16
|
+
"accessible-sequential": [
|
|
17
|
+
"#F7FBFF", "#DEEBF7", "#C6DBEF",
|
|
18
|
+
"#9ECAE1", "#6BAED6", "#3182BD",
|
|
19
|
+
"#08519C"
|
|
20
|
+
],
|
|
21
|
+
"accessible-diverging": [
|
|
22
|
+
"#D73027", "#F46D43", "#FDAE61",
|
|
23
|
+
"#FFFFBF", "#ABD9E9", "#74ADD1",
|
|
24
|
+
"#4575B4"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Color Rules
|
|
30
|
+
- Never use color as the only indicator — add icons, patterns, or labels
|
|
31
|
+
- Minimum contrast ratio: 4.5:1 for text, 3:1 for large text
|
|
32
|
+
- Test with color blindness simulators (Coblis, Color Oracle)
|
|
33
|
+
|
|
34
|
+
## Text and Typography
|
|
35
|
+
|
|
36
|
+
| Element | Minimum Size | Recommended |
|
|
37
|
+
|---------|-------------|-------------|
|
|
38
|
+
| Title | 14pt | 16-20pt |
|
|
39
|
+
| Subtitle | 12pt | 14pt |
|
|
40
|
+
| Labels | 10pt | 11-12pt |
|
|
41
|
+
| Axis labels | 9pt | 10-11pt |
|
|
42
|
+
| Tooltips | 10pt | 11pt |
|
|
43
|
+
|
|
44
|
+
## Keyboard Navigation
|
|
45
|
+
|
|
46
|
+
- All interactive elements must be tab-accessible
|
|
47
|
+
- Tab order should follow logical reading order (left→right, top→bottom)
|
|
48
|
+
- Use Alt Text on every visual (Visual > General > Alt Text)
|
|
49
|
+
|
|
50
|
+
## Alt Text Templates
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
// KPI Card
|
|
54
|
+
"Total Sales: $2.4M, up 12% versus last year"
|
|
55
|
+
|
|
56
|
+
// Bar Chart
|
|
57
|
+
"Bar chart showing sales by region. North leads at $800K, followed by South at $600K, East at $550K, and West at $450K"
|
|
58
|
+
|
|
59
|
+
// Trend Line
|
|
60
|
+
"Line chart showing monthly revenue trend from January to December 2024, with steady growth from $180K to $240K"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Screen Reader Best Practices
|
|
64
|
+
|
|
65
|
+
1. Set meaningful visual titles (not "Chart 1")
|
|
66
|
+
2. Add descriptions in Alt Text field
|
|
67
|
+
3. Include a data table alternative for complex visuals
|
|
68
|
+
4. Use headers in matrix/table visuals
|
|
69
|
+
5. Avoid auto-play animations
|
|
70
|
+
|
|
71
|
+
## Testing Checklist
|
|
72
|
+
|
|
73
|
+
- [ ] All visuals have Alt Text
|
|
74
|
+
- [ ] Tab order is logical
|
|
75
|
+
- [ ] Colors pass contrast ratio check
|
|
76
|
+
- [ ] No information conveyed by color alone
|
|
77
|
+
- [ ] Text meets minimum size requirements
|
|
78
|
+
- [ ] Report works with Windows Narrator / NVDA
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Chart Selection Guide
|
|
2
|
+
|
|
3
|
+
Quick reference for choosing the right visualization based on your data story.
|
|
4
|
+
|
|
5
|
+
## Decision Matrix
|
|
6
|
+
|
|
7
|
+
| Data Story | Best Chart | Avoid |
|
|
8
|
+
|-----------|-----------|-------|
|
|
9
|
+
| Compare values | Bar/Column | Pie (>5 categories) |
|
|
10
|
+
| Show trend over time | Line | Stacked bar |
|
|
11
|
+
| Part-to-whole | Treemap, Stacked bar | 3D pie |
|
|
12
|
+
| Distribution | Histogram, Box plot | Bar chart |
|
|
13
|
+
| Correlation | Scatter plot | Line chart |
|
|
14
|
+
| Geographic | Map, Filled map | Table with coordinates |
|
|
15
|
+
| KPI / single value | Card, Gauge | Bar with one value |
|
|
16
|
+
| Ranking | Horizontal bar (sorted) | Unsorted column |
|
|
17
|
+
| Flow / process | Sankey, Funnel | Pie chart |
|
|
18
|
+
| Composition over time | Stacked area | Multiple pies |
|
|
19
|
+
|
|
20
|
+
## Power BI Specific Tips
|
|
21
|
+
|
|
22
|
+
### Cards
|
|
23
|
+
```
|
|
24
|
+
// Use conditional formatting for KPI cards
|
|
25
|
+
TotalSales = SUM(Sales[Amount])
|
|
26
|
+
SalesVsPlan = DIVIDE([TotalSales] - [PlanSales], [PlanSales])
|
|
27
|
+
// Apply color rules: Green > 0, Red < 0
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Small Multiples
|
|
31
|
+
- Use for comparing the same metric across categories
|
|
32
|
+
- Maximum 9-12 panels for readability
|
|
33
|
+
- Keep axes consistent across all panels
|
|
34
|
+
|
|
35
|
+
### Decomposition Tree
|
|
36
|
+
- Best for ad-hoc root cause analysis
|
|
37
|
+
- AI splits find the highest/lowest contributors
|
|
38
|
+
- Limit depth to 4-5 levels
|
|
39
|
+
|
|
40
|
+
## IBCS Chart Standards
|
|
41
|
+
|
|
42
|
+
| IBCS Type | When to Use | Power BI Implementation |
|
|
43
|
+
|-----------|-------------|------------------------|
|
|
44
|
+
| Absolute variance | AC vs PY comparison | Clustered bar + variance bar |
|
|
45
|
+
| Relative variance | % change highlighting | Waterfall chart |
|
|
46
|
+
| Integrated variance | Budget vs actual | Combo chart (bar + line) |
|
|
47
|
+
|
|
48
|
+
## Anti-Patterns
|
|
49
|
+
|
|
50
|
+
- **Dual axis charts**: Misleading scale — use separate visuals instead
|
|
51
|
+
- **3D effects**: Distort perception — always use flat/2D
|
|
52
|
+
- **Truncated axes**: Starting Y-axis above 0 on bar charts misleads
|
|
53
|
+
- **Rainbow colors**: Use sequential or diverging palettes, not random colors
|
|
54
|
+
- **Too many data points**: Aggregate or filter — max 7±2 categories
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Report Layout Patterns
|
|
2
|
+
|
|
3
|
+
Proven page layout templates for Power BI reports.
|
|
4
|
+
|
|
5
|
+
## Executive Dashboard (Z-Pattern)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌──────────────────────────────────────────┐
|
|
9
|
+
│ Logo Title Date Slicers │ ← Header (60px)
|
|
10
|
+
├──────┬──────┬──────┬─────────────────────┤
|
|
11
|
+
│ KPI │ KPI │ KPI │ KPI │ ← KPI Row (120px)
|
|
12
|
+
│ Rev │ Marg │ Units│ YoY% │
|
|
13
|
+
├──────┴──────┴──────┴─────────────────────┤
|
|
14
|
+
│ │
|
|
15
|
+
│ Main Trend Chart (Line/Area) │ ← Primary Visual (280px)
|
|
16
|
+
│ │
|
|
17
|
+
├─────────────────────┬────────────────────┤
|
|
18
|
+
│ │ │
|
|
19
|
+
│ Breakdown Bar │ Top N Table │ ← Detail Row (260px)
|
|
20
|
+
│ │ │
|
|
21
|
+
└─────────────────────┴────────────────────┘
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Operational Detail (F-Pattern)
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
┌──────────────────────────────────────────┐
|
|
28
|
+
│ Filters: Region | Product | Date Range │ ← Filter Bar (50px)
|
|
29
|
+
├──────────────────────────────────────────┤
|
|
30
|
+
│ Status Cards: Open | In Progress | Done │ ← Status Row (80px)
|
|
31
|
+
├──────────────────────────────────────────┤
|
|
32
|
+
│ │
|
|
33
|
+
│ Data Table (sortable) │ ← Primary Detail (400px)
|
|
34
|
+
│ with conditional formatting │
|
|
35
|
+
│ │
|
|
36
|
+
├─────────────────────┬────────────────────┤
|
|
37
|
+
│ Trend Sparklines │ Action Items │ ← Footer Detail (160px)
|
|
38
|
+
└─────────────────────┴────────────────────┘
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Analytical Deep-Dive (Grid)
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
┌──────────┬───────────────────────────────┐
|
|
45
|
+
│ │ Scatter: Correlation │
|
|
46
|
+
│ Slicers │ │ ← Row 1 (350px)
|
|
47
|
+
│ Panel │ │
|
|
48
|
+
│ (200px) ├───────────────┬───────────────┤
|
|
49
|
+
│ │ Histogram │ Box Plot │ ← Row 2 (350px)
|
|
50
|
+
│ │ │ │
|
|
51
|
+
└──────────┴───────────────┴───────────────┘
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Spacing Standards
|
|
55
|
+
|
|
56
|
+
| Element | Spacing |
|
|
57
|
+
|---------|---------|
|
|
58
|
+
| Page margin | 16px all sides |
|
|
59
|
+
| Between visuals | 8-12px |
|
|
60
|
+
| Visual internal padding | 8px |
|
|
61
|
+
| Section grouping gap | 24px |
|
|
62
|
+
| Header height | 50-70px |
|
|
63
|
+
| KPI card height | 100-140px |
|
|
64
|
+
|
|
65
|
+
## Grid System
|
|
66
|
+
|
|
67
|
+
- Use Power BI's snap-to-grid (8px grid recommended)
|
|
68
|
+
- Standard page: 1280 x 720 (16:9 aspect ratio)
|
|
69
|
+
- Mobile: 360 x 640 (optimize for phone layout separately)
|
|
70
|
+
- Align visual edges — misalignment signals poor quality
|
|
71
|
+
|
|
72
|
+
## Navigation Patterns
|
|
73
|
+
|
|
74
|
+
### Tab-Style (3-7 pages)
|
|
75
|
+
```
|
|
76
|
+
[Overview] [Sales] [Products] [Customers] [Details]
|
|
77
|
+
```
|
|
78
|
+
Use buttons with page navigation bookmarks.
|
|
79
|
+
|
|
80
|
+
### Drill-Through (Detail on demand)
|
|
81
|
+
- Summary page → right-click → drill through to detail
|
|
82
|
+
- Always include a "Back" button on detail pages
|
|
83
|
+
|
|
84
|
+
### Tooltip Pages (Contextual info)
|
|
85
|
+
- Size: 320 x 240px (default tooltip size)
|
|
86
|
+
- Show 2-3 related metrics on hover
|
|
87
|
+
- Keep tooltip pages simple — no slicers or filters
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Data Model Templates
|
|
2
|
+
|
|
3
|
+
Star schema designs and semantic model specifications for common business domains.
|
|
4
|
+
|
|
5
|
+
## Available Models
|
|
6
|
+
|
|
7
|
+
| Model | Description | Complexity |
|
|
8
|
+
|-------|-------------|------------|
|
|
9
|
+
| [Retail Star Schema](./retail-star-schema.md) | Sales, inventory, customer analytics | Medium |
|
|
10
|
+
| [Finance Model](./finance-model.md) | GL, P&L, budget variance, multi-entity | High |
|
|
11
|
+
|
|
12
|
+
## What's Included
|
|
13
|
+
|
|
14
|
+
Each model specification includes:
|
|
15
|
+
|
|
16
|
+
- **Business Context** - Key questions the model answers
|
|
17
|
+
- **Schema Diagram** - Visual representation of tables and relationships
|
|
18
|
+
- **Dimension Tables** - Complete column definitions with data types
|
|
19
|
+
- **Fact Tables** - Transaction tables with grain and foreign keys
|
|
20
|
+
- **DAX Measures** - Pre-built calculations ready to implement
|
|
21
|
+
- **Hierarchies** - Drill-down paths for analysis
|
|
22
|
+
- **Implementation Notes** - Performance and configuration tips
|
|
23
|
+
- **Implementation Checklist** - Step-by-step verification
|
|
24
|
+
|
|
25
|
+
## How to Use
|
|
26
|
+
|
|
27
|
+
1. **Review business context** - Ensure the model answers your questions
|
|
28
|
+
2. **Map your data** - Identify source data for each table
|
|
29
|
+
3. **Create dimensions** - Build dimension tables with proper keys
|
|
30
|
+
4. **Create facts** - Build fact tables at the correct grain
|
|
31
|
+
5. **Build relationships** - Configure star schema relationships
|
|
32
|
+
6. **Implement measures** - Copy and adapt DAX measures
|
|
33
|
+
7. **Test** - Verify calculations against source data
|
|
34
|
+
|
|
35
|
+
## Model Categories
|
|
36
|
+
|
|
37
|
+
### Operational
|
|
38
|
+
- Retail Star Schema - Sales and inventory
|
|
39
|
+
|
|
40
|
+
### Financial
|
|
41
|
+
- Finance Model - General ledger and budgeting
|
|
42
|
+
|
|
43
|
+
### Coming Soon
|
|
44
|
+
- HR Analytics Model - Workforce and recruiting
|
|
45
|
+
- Supply Chain Model - Logistics and procurement
|
|
46
|
+
- Healthcare Model - Patient and clinical data
|
|
47
|
+
- SaaS Metrics Model - Subscription analytics
|
|
48
|
+
|
|
49
|
+
## Design Principles
|
|
50
|
+
|
|
51
|
+
### Star Schema
|
|
52
|
+
All models follow star schema best practices:
|
|
53
|
+
- Fact tables at the center
|
|
54
|
+
- Dimension tables connected via single relationships
|
|
55
|
+
- Avoid snowflaking (minimize dimension-to-dimension relationships)
|
|
56
|
+
- Use surrogate keys for joins
|
|
57
|
+
|
|
58
|
+
### Naming Conventions
|
|
59
|
+
- Fact tables: `Fact{Domain}` (e.g., FactSales)
|
|
60
|
+
- Dimension tables: `Dim{Entity}` (e.g., DimCustomer)
|
|
61
|
+
- Keys: `{TableName}Key` (e.g., CustomerKey)
|
|
62
|
+
- Measures: Descriptive names without prefixes
|
|
63
|
+
|
|
64
|
+
### Data Types
|
|
65
|
+
- Keys: INT (not VARCHAR for performance)
|
|
66
|
+
- Currency: DECIMAL(18,2)
|
|
67
|
+
- Dates: DATE (not DATETIME when time isn't needed)
|
|
68
|
+
- Percentages: DECIMAL(5,2) or calculated in DAX
|
|
69
|
+
|
|
70
|
+
## Relationship Rules
|
|
71
|
+
|
|
72
|
+
1. **Direction**: Single direction by default
|
|
73
|
+
2. **Cardinality**: Many-to-One from fact to dimension
|
|
74
|
+
3. **Active**: One active relationship per column pair
|
|
75
|
+
4. **Cross-filter**: Single direction for performance
|
|
76
|
+
|
|
77
|
+
## Related Resources
|
|
78
|
+
|
|
79
|
+
- [DAX Snippets](../../snippets/dax/) - Formula patterns
|
|
80
|
+
- [Data Modeling Skill](../../skills/data-modeling/) - AI assistance
|
|
81
|
+
- [Power BI Templates](../power-bi/) - Dashboard specifications
|
|
82
|
+
- [Design Wizard](../../skills/data-model-design/) - Interactive model design
|
|
83
|
+
|
|
84
|
+
## Contributing
|
|
85
|
+
|
|
86
|
+
To contribute a new model:
|
|
87
|
+
|
|
88
|
+
1. Use an existing model as a reference for structure
|
|
89
|
+
2. Include schema diagram (ASCII or mermaid)
|
|
90
|
+
3. Define all tables with column specifications
|
|
91
|
+
4. Provide working DAX measures
|
|
92
|
+
5. Document relationships and hierarchies
|
|
93
|
+
6. Submit a PR with the model markdown file
|