@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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.claude-plugin/skill-manifest.json +1 -1
- package/.plugin/plugin.json +1 -1
- package/bin/build-plugin.js +6 -6
- package/bin/cli.js +169 -310
- package/bin/commands/install.js +87 -70
- package/bin/lib/agents.js +19 -0
- package/bin/lib/mcp-config.js +23 -4
- package/desktop-extension/manifest.json +4 -11
- package/desktop-extension/server.js +34 -25
- package/package.json +3 -9
- package/skills/pbi-connect/SKILL.md +1 -1
- package/skills/project-kickoff/SKILL.md +1 -1
- package/bin/commands/add.js +0 -533
- package/bin/commands/add.test.js +0 -77
- package/bin/commands/changelog.js +0 -443
- package/bin/commands/pull.js +0 -287
- package/bin/commands/pull.test.js +0 -36
- package/bin/commands/push.js +0 -231
- package/bin/commands/push.test.js +0 -14
- package/bin/commands/search.js +0 -344
- package/bin/commands/search.test.js +0 -115
- package/bin/commands/setup.js +0 -545
- package/bin/commands/setup.test.js +0 -46
- package/bin/commands/sync-profile.js +0 -405
- package/bin/commands/sync-profile.test.js +0 -14
- package/bin/commands/sync-source.js +0 -418
- package/bin/commands/sync-source.test.js +0 -14
- package/bin/utils/errors.js +0 -159
- package/bin/utils/git.js +0 -298
- package/bin/utils/logger.js +0 -142
- package/bin/utils/pbix.js +0 -305
- package/bin/utils/pbix.test.js +0 -37
- package/bin/utils/profiles.js +0 -312
- package/bin/utils/projects.js +0 -169
- package/bin/utils/readline.js +0 -206
- package/bin/utils/readline.test.js +0 -47
- package/docs/openrouter-free-models.md +0 -92
- package/library/examples/README.md +0 -151
- package/library/examples/finance-reporting/README.md +0 -351
- package/library/examples/finance-reporting/data-model.md +0 -267
- package/library/examples/finance-reporting/measures.dax +0 -557
- package/library/examples/hr-analytics/README.md +0 -371
- package/library/examples/hr-analytics/data-model.md +0 -315
- package/library/examples/hr-analytics/measures.dax +0 -460
- package/library/examples/marketing-analytics/README.md +0 -37
- package/library/examples/marketing-analytics/data-model.md +0 -62
- package/library/examples/marketing-analytics/measures.dax +0 -110
- package/library/examples/retail-analytics/README.md +0 -439
- package/library/examples/retail-analytics/data-model.md +0 -288
- package/library/examples/retail-analytics/measures.dax +0 -481
- package/library/examples/supply-chain/README.md +0 -37
- package/library/examples/supply-chain/data-model.md +0 -69
- package/library/examples/supply-chain/measures.dax +0 -77
- package/library/examples/udf-library/README.md +0 -228
- package/library/examples/udf-library/functions.dax +0 -571
- package/library/snippets/dax/README.md +0 -292
- package/library/snippets/dax/business-domains.md +0 -576
- package/library/snippets/dax/calculate-patterns.md +0 -276
- package/library/snippets/dax/calculation-groups.md +0 -489
- package/library/snippets/dax/error-handling.md +0 -495
- package/library/snippets/dax/iterators-and-aggregations.md +0 -474
- package/library/snippets/dax/kpis-and-metrics.md +0 -293
- package/library/snippets/dax/rankings-and-topn.md +0 -235
- package/library/snippets/dax/security-patterns.md +0 -413
- package/library/snippets/dax/text-and-formatting.md +0 -316
- package/library/snippets/dax/time-intelligence.md +0 -196
- package/library/snippets/dax/user-defined-functions.md +0 -477
- package/library/snippets/dax/virtual-tables.md +0 -546
- package/library/snippets/excel-formulas/README.md +0 -84
- package/library/snippets/excel-formulas/aggregations.md +0 -330
- package/library/snippets/excel-formulas/dates-and-times.md +0 -361
- package/library/snippets/excel-formulas/dynamic-arrays.md +0 -314
- package/library/snippets/excel-formulas/lookups.md +0 -169
- package/library/snippets/excel-formulas/text-functions.md +0 -363
- package/library/snippets/governance/naming-conventions.md +0 -97
- package/library/snippets/governance/review-checklists.md +0 -107
- package/library/snippets/power-query/README.md +0 -389
- package/library/snippets/power-query/api-integration.md +0 -707
- package/library/snippets/power-query/connections.md +0 -434
- package/library/snippets/power-query/data-cleaning.md +0 -298
- package/library/snippets/power-query/error-handling.md +0 -526
- package/library/snippets/power-query/parameters.md +0 -350
- package/library/snippets/power-query/performance.md +0 -506
- package/library/snippets/power-query/transformations.md +0 -330
- package/library/snippets/report-design/accessibility.md +0 -78
- package/library/snippets/report-design/chart-selection.md +0 -54
- package/library/snippets/report-design/layout-patterns.md +0 -87
- package/library/templates/data-models/README.md +0 -93
- package/library/templates/data-models/finance-model.md +0 -627
- package/library/templates/data-models/retail-star-schema.md +0 -473
- package/library/templates/excel/README.md +0 -83
- package/library/templates/excel/budget-tracker.md +0 -432
- package/library/templates/excel/data-entry-form.md +0 -533
- package/library/templates/power-bi/README.md +0 -72
- package/library/templates/power-bi/finance-report.md +0 -449
- package/library/templates/power-bi/kpi-scorecard.md +0 -461
- package/library/templates/power-bi/sales-dashboard.md +0 -281
- package/library/themes/excel/README.md +0 -436
- package/library/themes/power-bi/README.md +0 -271
- package/library/themes/power-bi/accessible.json +0 -307
- package/library/themes/power-bi/bi-superpowers-default.json +0 -858
- package/library/themes/power-bi/corporate-blue.json +0 -291
- package/library/themes/power-bi/dark-mode.json +0 -291
- package/library/themes/power-bi/minimal.json +0 -292
- package/library/themes/power-bi/print-friendly.json +0 -309
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
# Finance Reporting - Complete Example
|
|
2
|
-
|
|
3
|
-
A comprehensive financial reporting solution for P&L, Balance Sheet, and Cash Flow analysis.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
This example demonstrates building a complete financial reporting solution using:
|
|
10
|
-
|
|
11
|
-
- **Multi-statement data model** supporting P&L, Balance Sheet, and Cash Flow
|
|
12
|
-
- **DAX measures** for period comparisons, variances, and financial ratios
|
|
13
|
-
- **Budget vs Actual** analysis with variance explanations
|
|
14
|
-
- **Rolling forecasts** and trend analysis
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## Business Requirements
|
|
19
|
-
|
|
20
|
-
### Stakeholders
|
|
21
|
-
- CFO: Executive financial overview
|
|
22
|
-
- Controllers: Detailed variance analysis
|
|
23
|
-
- FP&A Team: Budget tracking and forecasting
|
|
24
|
-
- Business Unit Leaders: Departmental P&L
|
|
25
|
-
|
|
26
|
-
### Key Questions
|
|
27
|
-
1. How are we performing vs. budget and prior year?
|
|
28
|
-
2. What's driving variance from plan?
|
|
29
|
-
3. What are our key financial ratios and trends?
|
|
30
|
-
4. How does each department/cost center perform?
|
|
31
|
-
5. What's the cash position and forecast?
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Data Model
|
|
36
|
-
|
|
37
|
-
### Star Schema Design
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
┌─────────────────┐
|
|
41
|
-
│ DimDate │
|
|
42
|
-
│─────────────────│
|
|
43
|
-
│ DateKey (PK) │
|
|
44
|
-
│ Date │
|
|
45
|
-
│ FiscalYear │
|
|
46
|
-
│ FiscalPeriod │
|
|
47
|
-
│ FiscalQuarter │
|
|
48
|
-
│ IsCurrentPeriod │
|
|
49
|
-
└────────┬────────┘
|
|
50
|
-
│
|
|
51
|
-
┌─────────────────┐ │ ┌─────────────────┐
|
|
52
|
-
│ DimAccount │ │ │ DimCostCenter │
|
|
53
|
-
│─────────────────│ │ │─────────────────│
|
|
54
|
-
│ AccountKey (PK) │ │ │ CostCenterKey │
|
|
55
|
-
│ AccountCode │ │ │ CostCenterCode │
|
|
56
|
-
│ AccountName │ │ │ CostCenterName │
|
|
57
|
-
│ AccountType │ │ │ Department │
|
|
58
|
-
│ AccountGroup │ │ │ Division │
|
|
59
|
-
│ FinancialStmt │ │ │ Manager │
|
|
60
|
-
│ NaturalSign │ │ └────────┬────────┘
|
|
61
|
-
│ SortOrder │ │ │
|
|
62
|
-
└────────┬────────┘ │ │
|
|
63
|
-
│ ┌─────────────┴───────────────┐ │
|
|
64
|
-
│ │ FactFinancials │ │
|
|
65
|
-
│ │─────────────────────────────│ │
|
|
66
|
-
└────>│ FinancialKey (PK) │<──┘
|
|
67
|
-
│ DateKey (FK) │
|
|
68
|
-
│ AccountKey (FK) │
|
|
69
|
-
│ CostCenterKey (FK) │
|
|
70
|
-
│ ScenarioKey (FK) │
|
|
71
|
-
│ Amount │
|
|
72
|
-
└─────────────┬───────────────┘
|
|
73
|
-
│
|
|
74
|
-
┌────────┴────────┐
|
|
75
|
-
│ DimScenario │
|
|
76
|
-
│─────────────────│
|
|
77
|
-
│ ScenarioKey (PK)│
|
|
78
|
-
│ ScenarioName │
|
|
79
|
-
│ ScenarioType │
|
|
80
|
-
│ IsActual │
|
|
81
|
-
└─────────────────┘
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Account Types
|
|
85
|
-
|
|
86
|
-
| AccountType | FinancialStatement | NaturalSign | Examples |
|
|
87
|
-
|-------------|-------------------|-------------|----------|
|
|
88
|
-
| Revenue | Income Statement | Credit (+) | Sales, Service Revenue |
|
|
89
|
-
| COGS | Income Statement | Debit (-) | Cost of Goods Sold |
|
|
90
|
-
| OpEx | Income Statement | Debit (-) | Salaries, Rent, Marketing |
|
|
91
|
-
| OtherIncome | Income Statement | Credit (+) | Interest Income |
|
|
92
|
-
| OtherExpense | Income Statement | Debit (-) | Interest Expense |
|
|
93
|
-
| Tax | Income Statement | Debit (-) | Income Tax |
|
|
94
|
-
| Asset | Balance Sheet | Debit (+) | Cash, AR, Inventory |
|
|
95
|
-
| Liability | Balance Sheet | Credit (-) | AP, Debt |
|
|
96
|
-
| Equity | Balance Sheet | Credit (-) | Retained Earnings |
|
|
97
|
-
|
|
98
|
-
### Scenarios
|
|
99
|
-
|
|
100
|
-
| ScenarioName | ScenarioType | IsActual | Purpose |
|
|
101
|
-
|--------------|--------------|----------|---------|
|
|
102
|
-
| Actual | Actual | TRUE | Recorded transactions |
|
|
103
|
-
| Budget | Budget | FALSE | Annual plan |
|
|
104
|
-
| Forecast | Forecast | FALSE | Rolling forecast |
|
|
105
|
-
| Prior Year | Actual | TRUE | Comparison baseline |
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## Key Measures
|
|
110
|
-
|
|
111
|
-
### Base Measures
|
|
112
|
-
|
|
113
|
-
```dax
|
|
114
|
-
// Actuals only
|
|
115
|
-
Actual Amount =
|
|
116
|
-
CALCULATE(
|
|
117
|
-
SUM(FactFinancials[Amount]),
|
|
118
|
-
DimScenario[IsActual] = TRUE()
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
// Budget only
|
|
122
|
-
Budget Amount =
|
|
123
|
-
CALCULATE(
|
|
124
|
-
SUM(FactFinancials[Amount]),
|
|
125
|
-
DimScenario[ScenarioName] = "Budget"
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
// Forecast only
|
|
129
|
-
Forecast Amount =
|
|
130
|
-
CALCULATE(
|
|
131
|
-
SUM(FactFinancials[Amount]),
|
|
132
|
-
DimScenario[ScenarioName] = "Forecast"
|
|
133
|
-
)
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Income Statement Measures
|
|
137
|
-
|
|
138
|
-
```dax
|
|
139
|
-
// Revenue (positive = good)
|
|
140
|
-
Revenue =
|
|
141
|
-
CALCULATE(
|
|
142
|
-
[Actual Amount],
|
|
143
|
-
DimAccount[AccountType] = "Revenue"
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
// Gross Profit
|
|
147
|
-
Gross Profit =
|
|
148
|
-
[Revenue] + CALCULATE([Actual Amount], DimAccount[AccountType] = "COGS")
|
|
149
|
-
|
|
150
|
-
// Gross Margin %
|
|
151
|
-
Gross Margin % =
|
|
152
|
-
DIVIDE([Gross Profit], [Revenue])
|
|
153
|
-
|
|
154
|
-
// Operating Expenses
|
|
155
|
-
OpEx =
|
|
156
|
-
CALCULATE(
|
|
157
|
-
[Actual Amount],
|
|
158
|
-
DimAccount[AccountType] = "OpEx"
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
// EBITDA
|
|
162
|
-
EBITDA =
|
|
163
|
-
[Gross Profit] + [OpEx]
|
|
164
|
-
|
|
165
|
-
// Net Income
|
|
166
|
-
Net Income =
|
|
167
|
-
CALCULATE(
|
|
168
|
-
[Actual Amount],
|
|
169
|
-
DimAccount[FinancialStmt] = "Income Statement"
|
|
170
|
-
)
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Variance Analysis
|
|
174
|
-
|
|
175
|
-
```dax
|
|
176
|
-
// Budget Variance (Actual - Budget)
|
|
177
|
-
Budget Variance =
|
|
178
|
-
[Actual Amount] - [Budget Amount]
|
|
179
|
-
|
|
180
|
-
// Budget Variance %
|
|
181
|
-
Budget Variance % =
|
|
182
|
-
DIVIDE([Budget Variance], ABS([Budget Amount]))
|
|
183
|
-
|
|
184
|
-
// Favorable/Unfavorable indicator
|
|
185
|
-
Variance Status =
|
|
186
|
-
VAR _Variance = [Budget Variance]
|
|
187
|
-
VAR _AccountType = SELECTEDVALUE(DimAccount[AccountType])
|
|
188
|
-
VAR _IsExpense = _AccountType IN {"COGS", "OpEx", "OtherExpense", "Tax"}
|
|
189
|
-
RETURN
|
|
190
|
-
SWITCH(
|
|
191
|
-
TRUE(),
|
|
192
|
-
ISBLANK(_Variance), BLANK(),
|
|
193
|
-
_IsExpense && _Variance < 0, "Favorable",
|
|
194
|
-
_IsExpense && _Variance > 0, "Unfavorable",
|
|
195
|
-
NOT _IsExpense && _Variance > 0, "Favorable",
|
|
196
|
-
"Unfavorable"
|
|
197
|
-
)
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### YTD and Period Comparisons
|
|
201
|
-
|
|
202
|
-
```dax
|
|
203
|
-
// Year-to-Date Actual
|
|
204
|
-
Actual YTD =
|
|
205
|
-
TOTALYTD([Actual Amount], DimDate[Date])
|
|
206
|
-
|
|
207
|
-
// Prior Year Same Period
|
|
208
|
-
Actual PY =
|
|
209
|
-
CALCULATE(
|
|
210
|
-
[Actual Amount],
|
|
211
|
-
SAMEPERIODLASTYEAR(DimDate[Date])
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
// Prior Year YTD
|
|
215
|
-
Actual YTD PY =
|
|
216
|
-
CALCULATE(
|
|
217
|
-
[Actual YTD],
|
|
218
|
-
SAMEPERIODLASTYEAR(DimDate[Date])
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
// YoY Growth %
|
|
222
|
-
YoY Growth % =
|
|
223
|
-
DIVIDE([Actual Amount] - [Actual PY], ABS([Actual PY]))
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
See [measures.dax](./measures.dax) for the complete measure library (50+ measures).
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## Report Pages
|
|
231
|
-
|
|
232
|
-
### 1. Executive Summary
|
|
233
|
-
|
|
234
|
-
| Visual | Content |
|
|
235
|
-
|--------|---------|
|
|
236
|
-
| KPI Cards | Revenue, Net Income, EBITDA with YoY % |
|
|
237
|
-
| Waterfall | Revenue to Net Income bridge |
|
|
238
|
-
| Line Chart | Monthly trend vs Prior Year |
|
|
239
|
-
| Table | Key metrics by Quarter |
|
|
240
|
-
|
|
241
|
-
### 2. P&L Statement
|
|
242
|
-
|
|
243
|
-
| Visual | Content |
|
|
244
|
-
|--------|---------|
|
|
245
|
-
| Matrix | Full P&L with hierarchy (Account Group > Account) |
|
|
246
|
-
| Columns | Actual, Budget, Variance, Variance %, PY |
|
|
247
|
-
| Conditional | Red/Green variance highlighting |
|
|
248
|
-
| Drill-through | To account detail page |
|
|
249
|
-
|
|
250
|
-
### 3. Variance Analysis
|
|
251
|
-
|
|
252
|
-
| Visual | Content |
|
|
253
|
-
|--------|---------|
|
|
254
|
-
| Decomposition Tree | Variance drivers by dimension |
|
|
255
|
-
| Scatter Plot | Budget vs Actual by Cost Center |
|
|
256
|
-
| Table | Top 10 variances with explanations |
|
|
257
|
-
| Bar Chart | Variance by Department |
|
|
258
|
-
|
|
259
|
-
### 4. Balance Sheet
|
|
260
|
-
|
|
261
|
-
| Visual | Content |
|
|
262
|
-
|--------|---------|
|
|
263
|
-
| Matrix | Assets, Liabilities, Equity structure |
|
|
264
|
-
| KPI Cards | Current Ratio, Quick Ratio, Debt/Equity |
|
|
265
|
-
| Waterfall | Change in Cash position |
|
|
266
|
-
|
|
267
|
-
### 5. Cash Flow
|
|
268
|
-
|
|
269
|
-
| Visual | Content |
|
|
270
|
-
|--------|---------|
|
|
271
|
-
| Waterfall | Operating, Investing, Financing flows |
|
|
272
|
-
| Line Chart | Cash balance trend |
|
|
273
|
-
| Table | Cash sources and uses |
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Financial Ratios
|
|
278
|
-
|
|
279
|
-
```dax
|
|
280
|
-
// Profitability
|
|
281
|
-
Gross Margin % = DIVIDE([Gross Profit], [Revenue])
|
|
282
|
-
Operating Margin % = DIVIDE([EBITDA], [Revenue])
|
|
283
|
-
Net Margin % = DIVIDE([Net Income], [Revenue])
|
|
284
|
-
ROE = DIVIDE([Net Income TTM], [Total Equity])
|
|
285
|
-
ROA = DIVIDE([Net Income TTM], [Total Assets])
|
|
286
|
-
|
|
287
|
-
// Liquidity
|
|
288
|
-
Current Ratio = DIVIDE([Current Assets], [Current Liabilities])
|
|
289
|
-
Quick Ratio = DIVIDE([Current Assets] - [Inventory], [Current Liabilities])
|
|
290
|
-
Cash Ratio = DIVIDE([Cash], [Current Liabilities])
|
|
291
|
-
|
|
292
|
-
// Leverage
|
|
293
|
-
Debt to Equity = DIVIDE([Total Debt], [Total Equity])
|
|
294
|
-
Debt to Assets = DIVIDE([Total Debt], [Total Assets])
|
|
295
|
-
Interest Coverage = DIVIDE([EBITDA], [Interest Expense])
|
|
296
|
-
|
|
297
|
-
// Efficiency
|
|
298
|
-
Days Sales Outstanding = DIVIDE([Accounts Receivable], [Revenue]) * 365
|
|
299
|
-
Days Payable Outstanding = DIVIDE([Accounts Payable], [COGS]) * 365
|
|
300
|
-
Inventory Turnover = DIVIDE([COGS], [Average Inventory])
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## Implementation Checklist
|
|
306
|
-
|
|
307
|
-
### Data Model
|
|
308
|
-
- [ ] Create DimDate with fiscal calendar attributes
|
|
309
|
-
- [ ] Create DimAccount with proper hierarchy and signs
|
|
310
|
-
- [ ] Create DimCostCenter with department/division structure
|
|
311
|
-
- [ ] Create DimScenario for Actual/Budget/Forecast
|
|
312
|
-
- [ ] Load FactFinancials with all scenario data
|
|
313
|
-
- [ ] Set up relationships
|
|
314
|
-
- [ ] Mark DimDate as Date Table
|
|
315
|
-
|
|
316
|
-
### Measures
|
|
317
|
-
- [ ] Create base measures (Actual, Budget, Forecast)
|
|
318
|
-
- [ ] Create P&L subtotals (Revenue, Gross Profit, EBITDA, Net Income)
|
|
319
|
-
- [ ] Create variance measures with favorable/unfavorable logic
|
|
320
|
-
- [ ] Create time intelligence (YTD, PY, YoY)
|
|
321
|
-
- [ ] Create financial ratios
|
|
322
|
-
- [ ] Organize in display folders
|
|
323
|
-
|
|
324
|
-
### Reports
|
|
325
|
-
- [ ] Executive Summary page
|
|
326
|
-
- [ ] P&L Statement with drill-through
|
|
327
|
-
- [ ] Variance Analysis with decomposition
|
|
328
|
-
- [ ] Balance Sheet snapshot
|
|
329
|
-
- [ ] Cash Flow statement
|
|
330
|
-
- [ ] Apply theme and formatting
|
|
331
|
-
|
|
332
|
-
---
|
|
333
|
-
|
|
334
|
-
## Files in This Example
|
|
335
|
-
|
|
336
|
-
| File | Description |
|
|
337
|
-
|------|-------------|
|
|
338
|
-
| [README.md](./README.md) | This overview |
|
|
339
|
-
| [data-model.md](./data-model.md) | Complete table definitions |
|
|
340
|
-
| [measures.dax](./measures.dax) | 50+ DAX measures |
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
## Tips for Financial Reporting
|
|
345
|
-
|
|
346
|
-
1. **Sign conventions matter** - Use NaturalSign to handle debit/credit properly
|
|
347
|
-
2. **Fiscal vs calendar** - Finance always uses fiscal periods
|
|
348
|
-
3. **Variance coloring** - Favorable expenses (under budget) should be green even if negative
|
|
349
|
-
4. **YTD resets** - Use fiscal year start date in TOTALYTD
|
|
350
|
-
5. **Balance sheet** - Point-in-time, not period aggregations
|
|
351
|
-
6. **Drill-through** - Essential for explaining variances
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
# Finance Reporting - Data Model
|
|
2
|
-
|
|
3
|
-
Complete table definitions for the financial reporting star schema.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Fact Table
|
|
8
|
-
|
|
9
|
-
### FactFinancials
|
|
10
|
-
|
|
11
|
-
| Column | Data Type | Description |
|
|
12
|
-
|--------|-----------|-------------|
|
|
13
|
-
| FinancialKey | Integer | Surrogate primary key |
|
|
14
|
-
| DateKey | Text | FK to DimDate (YYYYMMDD) |
|
|
15
|
-
| AccountKey | Integer | FK to DimAccount |
|
|
16
|
-
| CostCenterKey | Integer | FK to DimCostCenter |
|
|
17
|
-
| ScenarioKey | Integer | FK to DimScenario |
|
|
18
|
-
| Amount | Currency | Transaction amount (natural sign) |
|
|
19
|
-
|
|
20
|
-
**Grain:** One row per Account, Cost Center, Scenario, Period combination.
|
|
21
|
-
|
|
22
|
-
**Note:** Amount is stored in natural sign (positive for debits, negative for credits as recorded). Use DimAccount[NaturalSign] to flip for reporting.
|
|
23
|
-
|
|
24
|
-
**Relationships:**
|
|
25
|
-
- FactFinancials[DateKey] → DimDate[DateKey] (Many:1)
|
|
26
|
-
- FactFinancials[AccountKey] → DimAccount[AccountKey] (Many:1)
|
|
27
|
-
- FactFinancials[CostCenterKey] → DimCostCenter[CostCenterKey] (Many:1)
|
|
28
|
-
- FactFinancials[ScenarioKey] → DimScenario[ScenarioKey] (Many:1)
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Dimension Tables
|
|
33
|
-
|
|
34
|
-
### DimDate
|
|
35
|
-
|
|
36
|
-
| Column | Data Type | Description | Example |
|
|
37
|
-
|--------|-----------|-------------|---------|
|
|
38
|
-
| DateKey | Text | Primary key (YYYYMMDD) | "20240131" |
|
|
39
|
-
| Date | Date | Full date | 2024-01-31 |
|
|
40
|
-
| Year | Integer | Calendar year | 2024 |
|
|
41
|
-
| Month | Integer | Calendar month | 1 |
|
|
42
|
-
| MonthName | Text | Month name | "January" |
|
|
43
|
-
| Quarter | Text | Calendar quarter | "Q1" |
|
|
44
|
-
| FiscalYear | Integer | Fiscal year | 2024 |
|
|
45
|
-
| FiscalPeriod | Integer | Fiscal period (1-12) | 7 |
|
|
46
|
-
| FiscalPeriodName | Text | Fiscal period label | "FY24-P07" |
|
|
47
|
-
| FiscalQuarter | Text | Fiscal quarter | "FY24-Q3" |
|
|
48
|
-
| FiscalYearStart | Date | First day of fiscal year | 2023-07-01 |
|
|
49
|
-
| FiscalYearEnd | Date | Last day of fiscal year | 2024-06-30 |
|
|
50
|
-
| IsCurrentPeriod | Boolean | Current reporting period | TRUE |
|
|
51
|
-
| IsYTD | Boolean | Within current YTD | TRUE |
|
|
52
|
-
| DaysInMonth | Integer | Days in month | 31 |
|
|
53
|
-
| IsMonthEnd | Boolean | Last day of month | TRUE |
|
|
54
|
-
|
|
55
|
-
**Notes:**
|
|
56
|
-
- Assumes July fiscal year start (adjust for your organization)
|
|
57
|
-
- Mark as Date Table in Power BI
|
|
58
|
-
- Sort MonthName by Month
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
### DimAccount
|
|
63
|
-
|
|
64
|
-
| Column | Data Type | Description | Example |
|
|
65
|
-
|--------|-----------|-------------|---------|
|
|
66
|
-
| AccountKey | Integer | Surrogate PK | 1001 |
|
|
67
|
-
| AccountCode | Text | GL account code | "4010" |
|
|
68
|
-
| AccountName | Text | Account name | "Product Revenue" |
|
|
69
|
-
| AccountType | Text | Account classification | "Revenue" |
|
|
70
|
-
| AccountGroup | Text | Grouping level | "Net Revenue" |
|
|
71
|
-
| AccountSubGroup | Text | Sub-grouping | "Product Sales" |
|
|
72
|
-
| FinancialStmt | Text | Statement type | "Income Statement" |
|
|
73
|
-
| NaturalSign | Integer | Sign multiplier | 1 or -1 |
|
|
74
|
-
| SortOrder | Integer | Display order | 100 |
|
|
75
|
-
| Level | Integer | Hierarchy level | 3 |
|
|
76
|
-
| IsDetail | Boolean | Lowest level | TRUE |
|
|
77
|
-
| ParentAccountKey | Integer | Parent for hierarchy | 1000 |
|
|
78
|
-
|
|
79
|
-
**Account Types:**
|
|
80
|
-
|
|
81
|
-
| AccountType | FinancialStmt | NaturalSign | SortOrder Range |
|
|
82
|
-
|-------------|---------------|-------------|-----------------|
|
|
83
|
-
| Revenue | Income Statement | -1 | 100-199 |
|
|
84
|
-
| COGS | Income Statement | 1 | 200-299 |
|
|
85
|
-
| OpEx | Income Statement | 1 | 300-499 |
|
|
86
|
-
| OtherIncome | Income Statement | -1 | 500-549 |
|
|
87
|
-
| OtherExpense | Income Statement | 1 | 550-599 |
|
|
88
|
-
| Tax | Income Statement | 1 | 600-699 |
|
|
89
|
-
| Asset | Balance Sheet | 1 | 700-799 |
|
|
90
|
-
| Liability | Balance Sheet | -1 | 800-849 |
|
|
91
|
-
| Equity | Balance Sheet | -1 | 850-899 |
|
|
92
|
-
|
|
93
|
-
**NaturalSign Logic:**
|
|
94
|
-
- Revenue/Income: Stored as negative (credit), display as positive → NaturalSign = -1
|
|
95
|
-
- Expenses: Stored as positive (debit), display as positive → NaturalSign = 1
|
|
96
|
-
- Assets: Stored as positive (debit), display as positive → NaturalSign = 1
|
|
97
|
-
- Liabilities/Equity: Stored as negative (credit), display as positive → NaturalSign = -1
|
|
98
|
-
|
|
99
|
-
**Hierarchies:**
|
|
100
|
-
- AccountType > AccountGroup > AccountSubGroup > AccountName
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
### DimCostCenter
|
|
105
|
-
|
|
106
|
-
| Column | Data Type | Description | Example |
|
|
107
|
-
|--------|-----------|-------------|---------|
|
|
108
|
-
| CostCenterKey | Integer | Surrogate PK | 501 |
|
|
109
|
-
| CostCenterCode | Text | Business key | "CC-MKTG-001" |
|
|
110
|
-
| CostCenterName | Text | Name | "Marketing - Digital" |
|
|
111
|
-
| Department | Text | Department | "Marketing" |
|
|
112
|
-
| Division | Text | Division | "Commercial" |
|
|
113
|
-
| Region | Text | Geographic region | "North America" |
|
|
114
|
-
| Manager | Text | Responsible manager | "Jane Smith" |
|
|
115
|
-
| IsActive | Boolean | Currently active | TRUE |
|
|
116
|
-
|
|
117
|
-
**Hierarchies:**
|
|
118
|
-
- Division > Department > CostCenterName
|
|
119
|
-
- Region > CostCenterName
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
### DimScenario
|
|
124
|
-
|
|
125
|
-
| Column | Data Type | Description | Example |
|
|
126
|
-
|--------|-----------|-------------|---------|
|
|
127
|
-
| ScenarioKey | Integer | Surrogate PK | 1 |
|
|
128
|
-
| ScenarioName | Text | Scenario name | "Actual" |
|
|
129
|
-
| ScenarioType | Text | Type classification | "Actual" |
|
|
130
|
-
| ScenarioYear | Integer | Applicable year | 2024 |
|
|
131
|
-
| Version | Text | Version identifier | "v1.0" |
|
|
132
|
-
| IsActual | Boolean | Actual data flag | TRUE |
|
|
133
|
-
| IsBudget | Boolean | Budget data flag | FALSE |
|
|
134
|
-
| IsForecast | Boolean | Forecast data flag | FALSE |
|
|
135
|
-
| IsActive | Boolean | Currently active | TRUE |
|
|
136
|
-
| EffectiveDate | Date | When scenario applies | 2024-01-01 |
|
|
137
|
-
| Description | Text | Scenario notes | "FY24 Actual Results" |
|
|
138
|
-
|
|
139
|
-
**Standard Scenarios:**
|
|
140
|
-
|
|
141
|
-
| ScenarioName | ScenarioType | IsActual | IsBudget | IsForecast |
|
|
142
|
-
|--------------|--------------|----------|----------|------------|
|
|
143
|
-
| Actual | Actual | TRUE | FALSE | FALSE |
|
|
144
|
-
| Budget | Budget | FALSE | TRUE | FALSE |
|
|
145
|
-
| Forecast Q1 | Forecast | FALSE | FALSE | TRUE |
|
|
146
|
-
| Forecast Q2 | Forecast | FALSE | FALSE | TRUE |
|
|
147
|
-
| Prior Year Actual | Actual | TRUE | FALSE | FALSE |
|
|
148
|
-
| Stretch Target | Budget | FALSE | TRUE | FALSE |
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Sample Data
|
|
153
|
-
|
|
154
|
-
### DimAccount (Selected Rows)
|
|
155
|
-
|
|
156
|
-
| AccountKey | AccountCode | AccountName | AccountType | AccountGroup | NaturalSign | SortOrder |
|
|
157
|
-
|------------|-------------|-------------|-------------|--------------|-------------|-----------|
|
|
158
|
-
| 100 | 4000 | Net Revenue | Revenue | Net Revenue | -1 | 100 |
|
|
159
|
-
| 101 | 4010 | Product Revenue | Revenue | Net Revenue | -1 | 110 |
|
|
160
|
-
| 102 | 4020 | Service Revenue | Revenue | Net Revenue | -1 | 120 |
|
|
161
|
-
| 200 | 5000 | Cost of Goods Sold | COGS | COGS | 1 | 200 |
|
|
162
|
-
| 201 | 5010 | Materials | COGS | COGS | 1 | 210 |
|
|
163
|
-
| 202 | 5020 | Direct Labor | COGS | COGS | 1 | 220 |
|
|
164
|
-
| 300 | 6000 | Operating Expenses | OpEx | SG&A | 1 | 300 |
|
|
165
|
-
| 301 | 6100 | Salaries & Wages | OpEx | Personnel | 1 | 310 |
|
|
166
|
-
| 302 | 6200 | Rent & Facilities | OpEx | Occupancy | 1 | 320 |
|
|
167
|
-
| 303 | 6300 | Marketing | OpEx | Marketing | 1 | 330 |
|
|
168
|
-
|
|
169
|
-
### FactFinancials (Sample)
|
|
170
|
-
|
|
171
|
-
| FinancialKey | DateKey | AccountKey | CostCenterKey | ScenarioKey | Amount |
|
|
172
|
-
|--------------|---------|------------|---------------|-------------|--------|
|
|
173
|
-
| 1 | 20240131 | 101 | 501 | 1 | -150000 |
|
|
174
|
-
| 2 | 20240131 | 101 | 501 | 2 | -145000 |
|
|
175
|
-
| 3 | 20240131 | 201 | 501 | 1 | 45000 |
|
|
176
|
-
| 4 | 20240131 | 301 | 502 | 1 | 25000 |
|
|
177
|
-
| 5 | 20240131 | 303 | 503 | 1 | 18000 |
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## Calculated Columns
|
|
182
|
-
|
|
183
|
-
### Display Amount (with sign correction)
|
|
184
|
-
|
|
185
|
-
```dax
|
|
186
|
-
// Add to FactFinancials or use in measures
|
|
187
|
-
Display Amount =
|
|
188
|
-
FactFinancials[Amount] * RELATED(DimAccount[NaturalSign])
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Account Path (for hierarchy)
|
|
192
|
-
|
|
193
|
-
```dax
|
|
194
|
-
// Add to DimAccount
|
|
195
|
-
Account Path =
|
|
196
|
-
VAR _Path =
|
|
197
|
-
PATH(DimAccount[AccountKey], DimAccount[ParentAccountKey])
|
|
198
|
-
RETURN
|
|
199
|
-
_Path
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## Relationship Diagram
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
DimDate[DateKey] ─────────────────────────────────┐
|
|
208
|
-
│
|
|
209
|
-
DimAccount[AccountKey] ────────────────────────┐ │
|
|
210
|
-
│ │
|
|
211
|
-
DimCostCenter[CostCenterKey] ────────────────┐ │ │
|
|
212
|
-
│ │ │
|
|
213
|
-
DimScenario[ScenarioKey] ──────────────────┐ │ │ │
|
|
214
|
-
│ │ │ │
|
|
215
|
-
▼ ▼ ▼ ▼
|
|
216
|
-
┌────────────┐
|
|
217
|
-
│FactFinance │
|
|
218
|
-
└────────────┘
|
|
219
|
-
|
|
220
|
-
All relationships: Many-to-One, Single direction
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
## Power Query Notes
|
|
226
|
-
|
|
227
|
-
### Loading GL Data
|
|
228
|
-
|
|
229
|
-
```m
|
|
230
|
-
let
|
|
231
|
-
Source = Sql.Database("server", "FinanceDB"),
|
|
232
|
-
GL = Source{[Schema="dbo", Item="GeneralLedger"]}[Data],
|
|
233
|
-
|
|
234
|
-
// Filter to relevant periods
|
|
235
|
-
Filtered = Table.SelectRows(GL, each
|
|
236
|
-
[PostingDate] >= #date(2022, 1, 1)
|
|
237
|
-
),
|
|
238
|
-
|
|
239
|
-
// Map to dimension keys
|
|
240
|
-
WithKeys = Table.AddColumn(
|
|
241
|
-
Table.AddColumn(
|
|
242
|
-
Table.AddColumn(Filtered,
|
|
243
|
-
"DateKey", each Date.ToText([PostingDate], "yyyyMMdd")
|
|
244
|
-
),
|
|
245
|
-
"AccountKey", each [GLAccountID]
|
|
246
|
-
),
|
|
247
|
-
"CostCenterKey", each [CostCenterID]
|
|
248
|
-
),
|
|
249
|
-
|
|
250
|
-
// Aggregate to grain
|
|
251
|
-
Grouped = Table.Group(WithKeys,
|
|
252
|
-
{"DateKey", "AccountKey", "CostCenterKey", "ScenarioKey"},
|
|
253
|
-
{{"Amount", each List.Sum([Amount]), Currency.Type}}
|
|
254
|
-
)
|
|
255
|
-
in
|
|
256
|
-
Grouped
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
---
|
|
260
|
-
|
|
261
|
-
## Performance Tips
|
|
262
|
-
|
|
263
|
-
1. **Pre-aggregate** - Financial data should be at period/account grain, not transaction detail
|
|
264
|
-
2. **Use integer keys** - Faster joins than text account codes
|
|
265
|
-
3. **Filter early** - Apply date filters in Power Query
|
|
266
|
-
4. **Partition by year** - For large datasets, enable incremental refresh
|
|
267
|
-
5. **Avoid calculated columns** - Use measures with NaturalSign instead
|