@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,627 @@
|
|
|
1
|
+
# Finance Data Model
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
A comprehensive semantic model for financial reporting, budgeting, and analysis. Designed to support P&L statements, balance sheets, cash flow analysis, and budget variance tracking with proper account hierarchy handling.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Business Context
|
|
10
|
+
|
|
11
|
+
### Key Business Questions
|
|
12
|
+
|
|
13
|
+
1. **Profit & Loss**
|
|
14
|
+
- What is revenue, COGS, and net income by period?
|
|
15
|
+
- How do expenses trend over time?
|
|
16
|
+
- What is the margin by product line or department?
|
|
17
|
+
|
|
18
|
+
2. **Budget Analysis**
|
|
19
|
+
- How do actuals compare to budget?
|
|
20
|
+
- What are the key variance drivers?
|
|
21
|
+
- What is the forecast for year-end?
|
|
22
|
+
|
|
23
|
+
3. **Balance Sheet**
|
|
24
|
+
- What are current assets and liabilities?
|
|
25
|
+
- How has working capital changed?
|
|
26
|
+
- What is the debt-to-equity ratio?
|
|
27
|
+
|
|
28
|
+
4. **Cash Flow**
|
|
29
|
+
- What is cash from operations?
|
|
30
|
+
- How much was invested in CapEx?
|
|
31
|
+
- What is the cash runway?
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Schema Diagram
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
┌─────────────┐
|
|
39
|
+
│ DimDate │
|
|
40
|
+
│─────────────│
|
|
41
|
+
│ DateKey (PK)│
|
|
42
|
+
│ Date │
|
|
43
|
+
│ FiscalYear │
|
|
44
|
+
│ FiscalPeriod│
|
|
45
|
+
│ IsActual │
|
|
46
|
+
└──────┬──────┘
|
|
47
|
+
│
|
|
48
|
+
│ 1:M
|
|
49
|
+
│
|
|
50
|
+
┌─────────────┐ ┌──────┴──────┐ ┌─────────────┐
|
|
51
|
+
│ DimAccount │ │ FactGL │ │DimScenario │
|
|
52
|
+
│─────────────│ │─────────────│ │─────────────│
|
|
53
|
+
│AccountKey PK│────>│ GLKey (PK) │<────│ScenarioKey │
|
|
54
|
+
│ AccountID │ M:1 │ DateKey (FK)│ 1:M │ ScenarioID │
|
|
55
|
+
│ AccountName │ │AccountKey FK│ │ScenarioName │
|
|
56
|
+
│ AccountType │ │ScenarioKey │ │ ScenarioType│
|
|
57
|
+
│ AccountGroup│ │CostCenterKey│ └─────────────┘
|
|
58
|
+
│ ParentAcct │ │ EntityKey FK│
|
|
59
|
+
│ L1-L5 Hier │ │ Debit │ ┌─────────────┐
|
|
60
|
+
│ IsPL/IsBS │ │ Credit │ │DimCostCenter│
|
|
61
|
+
│ SignConv │ │ Amount │ │─────────────│
|
|
62
|
+
└─────────────┘ └──────┬──────┘ │CostCenterKey│
|
|
63
|
+
│ │CostCenterID │
|
|
64
|
+
┌────────────────┘ │ Name │
|
|
65
|
+
│ │ Department │
|
|
66
|
+
│ M:1 │ Division │
|
|
67
|
+
▼ │ Manager │
|
|
68
|
+
┌─────────────┐ └─────────────┘
|
|
69
|
+
│ DimEntity │
|
|
70
|
+
│─────────────│ ┌─────────────┐
|
|
71
|
+
│EntityKey PK │ │ FactBudget │
|
|
72
|
+
│ EntityID │ │─────────────│
|
|
73
|
+
│ EntityName │ │ BudgetKey │
|
|
74
|
+
│ Currency │ │ DateKey │
|
|
75
|
+
│ ParentEntity│ │ AccountKey │
|
|
76
|
+
│ IsElim │ │CostCenterKey│
|
|
77
|
+
└─────────────┘ │ ScenarioKey │
|
|
78
|
+
│ Amount │
|
|
79
|
+
└─────────────┘
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Dimension Tables
|
|
85
|
+
|
|
86
|
+
### DimDate (Financial Calendar)
|
|
87
|
+
|
|
88
|
+
**Purpose:** Fiscal calendar with period close tracking
|
|
89
|
+
|
|
90
|
+
| Column | Data Type | Description | Sample Values |
|
|
91
|
+
|--------|-----------|-------------|---------------|
|
|
92
|
+
| DateKey | INT | Surrogate key (YYYYMMDD) | 20240115 |
|
|
93
|
+
| Date | DATE | Full date | 2024-01-15 |
|
|
94
|
+
| CalendarYear | INT | Calendar year | 2024 |
|
|
95
|
+
| CalendarMonth | INT | Calendar month | 1 |
|
|
96
|
+
| CalendarQuarter | INT | Calendar quarter | 1 |
|
|
97
|
+
| FiscalYear | INT | Fiscal year | 2024 |
|
|
98
|
+
| FiscalPeriod | INT | Fiscal period (1-12 or 1-13) | 7 |
|
|
99
|
+
| FiscalQuarter | INT | Fiscal quarter | 3 |
|
|
100
|
+
| FiscalYearMonth | VARCHAR(10) | FY-Period label | FY24-P07 |
|
|
101
|
+
| PeriodStartDate | DATE | First day of period | 2024-01-01 |
|
|
102
|
+
| PeriodEndDate | DATE | Last day of period | 2024-01-31 |
|
|
103
|
+
| IsActualPeriod | BIT | Has actual data | 1 |
|
|
104
|
+
| IsClosed | BIT | Period is closed | 1 |
|
|
105
|
+
| DaysInPeriod | INT | Days in fiscal period | 31 |
|
|
106
|
+
| IsYearEnd | BIT | Year-end period | 0 |
|
|
107
|
+
|
|
108
|
+
### DimAccount (Chart of Accounts)
|
|
109
|
+
|
|
110
|
+
**Purpose:** Account hierarchy with financial statement mapping
|
|
111
|
+
|
|
112
|
+
| Column | Data Type | Description | Sample Values |
|
|
113
|
+
|--------|-----------|-------------|---------------|
|
|
114
|
+
| AccountKey | INT | Surrogate key | 1001 |
|
|
115
|
+
| AccountID | VARCHAR(20) | GL account number | 4010 |
|
|
116
|
+
| AccountName | VARCHAR(100) | Account name | Product Revenue |
|
|
117
|
+
| AccountDescription | VARCHAR(500) | Full description | Revenue from product sales |
|
|
118
|
+
| AccountType | VARCHAR(30) | High-level type | Revenue |
|
|
119
|
+
| AccountGroup | VARCHAR(50) | Grouping | Operating Revenue |
|
|
120
|
+
| AccountClass | VARCHAR(30) | Class | Income Statement |
|
|
121
|
+
| StatementLine | VARCHAR(50) | Financial statement line | Net Revenue |
|
|
122
|
+
| L1_Category | VARCHAR(50) | Hierarchy Level 1 | Income Statement |
|
|
123
|
+
| L2_Category | VARCHAR(50) | Hierarchy Level 2 | Revenue |
|
|
124
|
+
| L3_Category | VARCHAR(50) | Hierarchy Level 3 | Operating Revenue |
|
|
125
|
+
| L4_Category | VARCHAR(50) | Hierarchy Level 4 | Product Revenue |
|
|
126
|
+
| L5_Account | VARCHAR(100) | Hierarchy Level 5 (Detail) | Product Revenue - Domestic |
|
|
127
|
+
| ParentAccountKey | INT | Parent in hierarchy | 1000 |
|
|
128
|
+
| IsBS | BIT | Balance Sheet account | 0 |
|
|
129
|
+
| IsPL | BIT | P&L account | 1 |
|
|
130
|
+
| IsCF | BIT | Cash Flow relevant | 0 |
|
|
131
|
+
| NormalBalance | VARCHAR(10) | Debit or Credit | Credit |
|
|
132
|
+
| SignConvention | INT | Sign for reporting (+1/-1) | -1 |
|
|
133
|
+
| SortOrder | INT | Display order | 100 |
|
|
134
|
+
| IsActive | BIT | Active account | 1 |
|
|
135
|
+
| IsPostable | BIT | Can receive postings | 1 |
|
|
136
|
+
|
|
137
|
+
**Account Types:**
|
|
138
|
+
```
|
|
139
|
+
Balance Sheet (IsBS = 1):
|
|
140
|
+
- Asset
|
|
141
|
+
- Liability
|
|
142
|
+
- Equity
|
|
143
|
+
|
|
144
|
+
Income Statement (IsPL = 1):
|
|
145
|
+
- Revenue
|
|
146
|
+
- COGS
|
|
147
|
+
- Operating Expense
|
|
148
|
+
- Other Income/Expense
|
|
149
|
+
- Tax
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Sign Convention:**
|
|
153
|
+
```
|
|
154
|
+
Revenue accounts: SignConvention = -1
|
|
155
|
+
(Credit balance shows as positive)
|
|
156
|
+
|
|
157
|
+
Expense accounts: SignConvention = 1
|
|
158
|
+
(Debit balance shows as positive)
|
|
159
|
+
|
|
160
|
+
Asset accounts: SignConvention = 1
|
|
161
|
+
(Debit balance shows as positive)
|
|
162
|
+
|
|
163
|
+
Liability/Equity: SignConvention = -1
|
|
164
|
+
(Credit balance shows as positive)
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### DimScenario (Scenario Dimension)
|
|
168
|
+
|
|
169
|
+
**Purpose:** Actual, Budget, Forecast versions
|
|
170
|
+
|
|
171
|
+
| Column | Data Type | Description | Sample Values |
|
|
172
|
+
|--------|-----------|-------------|---------------|
|
|
173
|
+
| ScenarioKey | INT | Surrogate key | 1 |
|
|
174
|
+
| ScenarioID | VARCHAR(20) | Scenario code | ACT |
|
|
175
|
+
| ScenarioName | VARCHAR(50) | Display name | Actual |
|
|
176
|
+
| ScenarioType | VARCHAR(30) | Type classification | Actual |
|
|
177
|
+
| IsActual | BIT | Actual data flag | 1 |
|
|
178
|
+
| IsBudget | BIT | Budget version flag | 0 |
|
|
179
|
+
| IsForecast | BIT | Forecast version flag | 0 |
|
|
180
|
+
| FiscalYear | INT | Applicable year | 2024 |
|
|
181
|
+
| Version | VARCHAR(20) | Version number | v1.0 |
|
|
182
|
+
| ApprovedDate | DATE | Approval date | 2023-12-15 |
|
|
183
|
+
| IsActive | BIT | Current/active | 1 |
|
|
184
|
+
|
|
185
|
+
**Common Scenarios:**
|
|
186
|
+
```
|
|
187
|
+
1. Actual (ACT) - Recorded transactions
|
|
188
|
+
2. Budget (BUD) - Annual approved budget
|
|
189
|
+
3. Forecast (FC1, FC2, FC3) - Quarterly reforecasts
|
|
190
|
+
4. Prior Year (PY) - Last year actuals
|
|
191
|
+
5. Plan (PLN) - Long-term plan
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### DimCostCenter (Cost Center Dimension)
|
|
195
|
+
|
|
196
|
+
**Purpose:** Organizational hierarchy for expenses
|
|
197
|
+
|
|
198
|
+
| Column | Data Type | Description | Sample Values |
|
|
199
|
+
|--------|-----------|-------------|---------------|
|
|
200
|
+
| CostCenterKey | INT | Surrogate key | 501 |
|
|
201
|
+
| CostCenterID | VARCHAR(20) | Cost center code | CC-100 |
|
|
202
|
+
| CostCenterName | VARCHAR(100) | Name | Engineering |
|
|
203
|
+
| Department | VARCHAR(50) | Department | Technology |
|
|
204
|
+
| Division | VARCHAR(50) | Division | Product |
|
|
205
|
+
| BusinessUnit | VARCHAR(50) | Business unit | Software |
|
|
206
|
+
| ManagerName | VARCHAR(100) | Responsible manager | John Smith |
|
|
207
|
+
| ManagerEmail | VARCHAR(100) | Manager email | john.smith@company.com |
|
|
208
|
+
| ParentCostCenterKey | INT | Parent in hierarchy | 500 |
|
|
209
|
+
| L1_Division | VARCHAR(50) | Hierarchy Level 1 | Product |
|
|
210
|
+
| L2_Department | VARCHAR(50) | Hierarchy Level 2 | Technology |
|
|
211
|
+
| L3_CostCenter | VARCHAR(50) | Hierarchy Level 3 | Engineering |
|
|
212
|
+
| IsActive | BIT | Active cost center | 1 |
|
|
213
|
+
|
|
214
|
+
### DimEntity (Legal Entity Dimension)
|
|
215
|
+
|
|
216
|
+
**Purpose:** Multi-company consolidation
|
|
217
|
+
|
|
218
|
+
| Column | Data Type | Description | Sample Values |
|
|
219
|
+
|--------|-----------|-------------|---------------|
|
|
220
|
+
| EntityKey | INT | Surrogate key | 1 |
|
|
221
|
+
| EntityID | VARCHAR(20) | Entity code | US01 |
|
|
222
|
+
| EntityName | VARCHAR(100) | Legal name | Company USA Inc. |
|
|
223
|
+
| ShortName | VARCHAR(50) | Short name | USA |
|
|
224
|
+
| Currency | VARCHAR(3) | Local currency | USD |
|
|
225
|
+
| Country | VARCHAR(50) | Country | United States |
|
|
226
|
+
| Region | VARCHAR(30) | Region | Americas |
|
|
227
|
+
| EntityType | VARCHAR(30) | Type | Operating |
|
|
228
|
+
| ParentEntityKey | INT | Parent entity | NULL |
|
|
229
|
+
| ConsolidationPct | DECIMAL(5,2) | Ownership % | 100.00 |
|
|
230
|
+
| IsElimination | BIT | Elimination entity | 0 |
|
|
231
|
+
| IsConsolidated | BIT | Include in consolidation | 1 |
|
|
232
|
+
| IsActive | BIT | Active entity | 1 |
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Fact Tables
|
|
237
|
+
|
|
238
|
+
### FactGL (General Ledger)
|
|
239
|
+
|
|
240
|
+
**Purpose:** Journal entry level detail
|
|
241
|
+
|
|
242
|
+
| Column | Data Type | Description | Grain |
|
|
243
|
+
|--------|-----------|-------------|-------|
|
|
244
|
+
| GLKey | BIGINT | Surrogate key | One row per journal line |
|
|
245
|
+
| DateKey | INT | Transaction date (FK) | |
|
|
246
|
+
| AccountKey | INT | GL Account (FK) | |
|
|
247
|
+
| ScenarioKey | INT | Scenario (FK) | |
|
|
248
|
+
| CostCenterKey | INT | Cost Center (FK) | |
|
|
249
|
+
| EntityKey | INT | Legal Entity (FK) | |
|
|
250
|
+
| JournalID | VARCHAR(30) | Journal entry ID | |
|
|
251
|
+
| LineNumber | INT | Line in journal | |
|
|
252
|
+
| Debit | DECIMAL(18,2) | Debit amount | |
|
|
253
|
+
| Credit | DECIMAL(18,2) | Credit amount | |
|
|
254
|
+
| Amount | DECIMAL(18,2) | Net amount (Debit - Credit) | |
|
|
255
|
+
| LocalAmount | DECIMAL(18,2) | Amount in local currency | |
|
|
256
|
+
| FXRate | DECIMAL(12,6) | Exchange rate | |
|
|
257
|
+
| Description | VARCHAR(500) | Transaction description | |
|
|
258
|
+
| Reference | VARCHAR(50) | External reference | |
|
|
259
|
+
| PostedBy | VARCHAR(50) | User who posted | |
|
|
260
|
+
| PostedDate | DATETIME | Posting timestamp | |
|
|
261
|
+
|
|
262
|
+
### FactBudget (Budget/Forecast)
|
|
263
|
+
|
|
264
|
+
**Purpose:** Budget and forecast data at summary level
|
|
265
|
+
|
|
266
|
+
| Column | Data Type | Description | Grain |
|
|
267
|
+
|--------|-----------|-------------|-------|
|
|
268
|
+
| BudgetKey | BIGINT | Surrogate key | One row per account/CC/period |
|
|
269
|
+
| DateKey | INT | Period start date (FK) | |
|
|
270
|
+
| AccountKey | INT | GL Account (FK) | |
|
|
271
|
+
| ScenarioKey | INT | Scenario (FK) | |
|
|
272
|
+
| CostCenterKey | INT | Cost Center (FK) | |
|
|
273
|
+
| EntityKey | INT | Legal Entity (FK) | |
|
|
274
|
+
| Amount | DECIMAL(18,2) | Budget amount | |
|
|
275
|
+
| Units | INT | Budget units (optional) | |
|
|
276
|
+
| Notes | VARCHAR(500) | Budget assumptions | |
|
|
277
|
+
| VersionDate | DATE | Version date | |
|
|
278
|
+
|
|
279
|
+
### FactBalance (Balance Sheet Snapshots - Optional)
|
|
280
|
+
|
|
281
|
+
**Purpose:** Period-end balances for BS accounts
|
|
282
|
+
|
|
283
|
+
| Column | Data Type | Description | Grain |
|
|
284
|
+
|--------|-----------|-------------|-------|
|
|
285
|
+
| BalanceKey | BIGINT | Surrogate key | One row per account/entity/period |
|
|
286
|
+
| DateKey | INT | Period end date (FK) | |
|
|
287
|
+
| AccountKey | INT | GL Account (FK) | |
|
|
288
|
+
| EntityKey | INT | Legal Entity (FK) | |
|
|
289
|
+
| ScenarioKey | INT | Scenario (FK) | |
|
|
290
|
+
| BeginningBalance | DECIMAL(18,2) | Opening balance | |
|
|
291
|
+
| Activity | DECIMAL(18,2) | Period activity | |
|
|
292
|
+
| EndingBalance | DECIMAL(18,2) | Closing balance | |
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Recommended DAX Measures
|
|
297
|
+
|
|
298
|
+
### Core Financial Measures
|
|
299
|
+
|
|
300
|
+
```dax
|
|
301
|
+
// Amount with Sign Convention
|
|
302
|
+
Amount =
|
|
303
|
+
SUMX(
|
|
304
|
+
FactGL,
|
|
305
|
+
FactGL[Amount] * RELATED(DimAccount[SignConvention])
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
// Or simpler if Amount already signed correctly
|
|
309
|
+
Total Amount =
|
|
310
|
+
SUM(FactGL[Amount])
|
|
311
|
+
|
|
312
|
+
// Revenue
|
|
313
|
+
Revenue =
|
|
314
|
+
CALCULATE(
|
|
315
|
+
[Amount],
|
|
316
|
+
DimAccount[AccountType] = "Revenue"
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
// COGS
|
|
320
|
+
COGS =
|
|
321
|
+
CALCULATE(
|
|
322
|
+
[Amount],
|
|
323
|
+
DimAccount[AccountType] = "COGS"
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
// Gross Profit
|
|
327
|
+
Gross Profit =
|
|
328
|
+
[Revenue] - [COGS]
|
|
329
|
+
|
|
330
|
+
// Gross Margin %
|
|
331
|
+
Gross Margin % =
|
|
332
|
+
DIVIDE([Gross Profit], [Revenue])
|
|
333
|
+
|
|
334
|
+
// Operating Expenses
|
|
335
|
+
Operating Expenses =
|
|
336
|
+
CALCULATE(
|
|
337
|
+
[Amount],
|
|
338
|
+
DimAccount[AccountType] = "Operating Expense"
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
// EBITDA
|
|
342
|
+
EBITDA =
|
|
343
|
+
[Gross Profit] - [Operating Expenses] + [Depreciation & Amortization]
|
|
344
|
+
|
|
345
|
+
// Net Income
|
|
346
|
+
Net Income =
|
|
347
|
+
CALCULATE(
|
|
348
|
+
[Amount],
|
|
349
|
+
DimAccount[IsPL] = TRUE
|
|
350
|
+
)
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### Budget Variance
|
|
354
|
+
|
|
355
|
+
```dax
|
|
356
|
+
// Budget Amount
|
|
357
|
+
Budget Amount =
|
|
358
|
+
CALCULATE(
|
|
359
|
+
[Amount],
|
|
360
|
+
DimScenario[ScenarioName] = "Budget"
|
|
361
|
+
)
|
|
362
|
+
|
|
363
|
+
// Actual Amount
|
|
364
|
+
Actual Amount =
|
|
365
|
+
CALCULATE(
|
|
366
|
+
[Amount],
|
|
367
|
+
DimScenario[ScenarioName] = "Actual"
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
// Variance
|
|
371
|
+
Variance $ =
|
|
372
|
+
[Actual Amount] - [Budget Amount]
|
|
373
|
+
|
|
374
|
+
// Variance % (context-aware)
|
|
375
|
+
Variance % =
|
|
376
|
+
VAR _Actual = [Actual Amount]
|
|
377
|
+
VAR _Budget = [Budget Amount]
|
|
378
|
+
VAR _AccountType = SELECTEDVALUE(DimAccount[AccountType])
|
|
379
|
+
VAR _IsExpense = _AccountType IN {"COGS", "Operating Expense", "Other Expense"}
|
|
380
|
+
RETURN
|
|
381
|
+
IF(
|
|
382
|
+
_IsExpense,
|
|
383
|
+
DIVIDE(_Budget - _Actual, ABS(_Budget)), // Under budget is positive
|
|
384
|
+
DIVIDE(_Actual - _Budget, ABS(_Budget)) // Over revenue is positive
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
// Variance Status
|
|
388
|
+
Variance Status =
|
|
389
|
+
VAR _Var = [Variance %]
|
|
390
|
+
RETURN
|
|
391
|
+
SWITCH(
|
|
392
|
+
TRUE(),
|
|
393
|
+
_Var >= 0, "Favorable",
|
|
394
|
+
_Var >= -0.05, "On Track",
|
|
395
|
+
_Var >= -0.10, "At Risk",
|
|
396
|
+
"Unfavorable"
|
|
397
|
+
)
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Period Intelligence
|
|
401
|
+
|
|
402
|
+
```dax
|
|
403
|
+
// YTD Amount
|
|
404
|
+
YTD Amount =
|
|
405
|
+
TOTALYTD(
|
|
406
|
+
[Amount],
|
|
407
|
+
DimDate[Date],
|
|
408
|
+
"6/30" // Fiscal year end if not Dec 31
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
// Prior Year
|
|
412
|
+
Prior Year =
|
|
413
|
+
CALCULATE(
|
|
414
|
+
[Amount],
|
|
415
|
+
SAMEPERIODLASTYEAR(DimDate[Date])
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
// YoY Change
|
|
419
|
+
YoY Change =
|
|
420
|
+
[Amount] - [Prior Year]
|
|
421
|
+
|
|
422
|
+
// YoY %
|
|
423
|
+
YoY % =
|
|
424
|
+
DIVIDE([YoY Change], ABS([Prior Year]))
|
|
425
|
+
|
|
426
|
+
// MTD
|
|
427
|
+
MTD Amount =
|
|
428
|
+
TOTALMTD([Amount], DimDate[Date])
|
|
429
|
+
|
|
430
|
+
// Full Year Run Rate
|
|
431
|
+
Full Year Run Rate =
|
|
432
|
+
VAR _YTD = [YTD Amount]
|
|
433
|
+
VAR _MonthsElapsed = DISTINCTCOUNT(DimDate[FiscalPeriod])
|
|
434
|
+
RETURN
|
|
435
|
+
DIVIDE(_YTD * 12, _MonthsElapsed)
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Balance Sheet Measures
|
|
439
|
+
|
|
440
|
+
```dax
|
|
441
|
+
// Ending Balance (cumulative for BS)
|
|
442
|
+
Ending Balance =
|
|
443
|
+
CALCULATE(
|
|
444
|
+
[Amount],
|
|
445
|
+
FILTER(
|
|
446
|
+
ALL(DimDate),
|
|
447
|
+
DimDate[Date] <= MAX(DimDate[Date])
|
|
448
|
+
),
|
|
449
|
+
DimAccount[IsBS] = TRUE
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
// Current Assets
|
|
453
|
+
Current Assets =
|
|
454
|
+
CALCULATE(
|
|
455
|
+
[Ending Balance],
|
|
456
|
+
DimAccount[AccountGroup] = "Current Assets"
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
// Current Liabilities
|
|
460
|
+
Current Liabilities =
|
|
461
|
+
CALCULATE(
|
|
462
|
+
[Ending Balance],
|
|
463
|
+
DimAccount[AccountGroup] = "Current Liabilities"
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
// Working Capital
|
|
467
|
+
Working Capital =
|
|
468
|
+
[Current Assets] + [Current Liabilities] // Liabilities are negative
|
|
469
|
+
|
|
470
|
+
// Current Ratio
|
|
471
|
+
Current Ratio =
|
|
472
|
+
DIVIDE([Current Assets], ABS([Current Liabilities]))
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
### Financial Ratios
|
|
476
|
+
|
|
477
|
+
```dax
|
|
478
|
+
// Operating Margin
|
|
479
|
+
Operating Margin =
|
|
480
|
+
DIVIDE([EBITDA], [Revenue])
|
|
481
|
+
|
|
482
|
+
// Return on Assets
|
|
483
|
+
ROA =
|
|
484
|
+
DIVIDE(
|
|
485
|
+
[Net Income],
|
|
486
|
+
CALCULATE([Ending Balance], DimAccount[AccountType] = "Asset")
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
// Debt to Equity
|
|
490
|
+
Debt to Equity =
|
|
491
|
+
DIVIDE(
|
|
492
|
+
CALCULATE([Ending Balance], DimAccount[AccountType] = "Liability"),
|
|
493
|
+
CALCULATE([Ending Balance], DimAccount[AccountType] = "Equity")
|
|
494
|
+
)
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## P&L Structure
|
|
500
|
+
|
|
501
|
+
### Standard P&L Order
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
Revenue
|
|
505
|
+
Product Revenue
|
|
506
|
+
Service Revenue
|
|
507
|
+
Other Revenue
|
|
508
|
+
─────────────────────
|
|
509
|
+
Total Revenue
|
|
510
|
+
|
|
511
|
+
Cost of Goods Sold
|
|
512
|
+
Direct Materials
|
|
513
|
+
Direct Labor
|
|
514
|
+
Manufacturing Overhead
|
|
515
|
+
─────────────────────
|
|
516
|
+
Total COGS
|
|
517
|
+
|
|
518
|
+
GROSS PROFIT
|
|
519
|
+
|
|
520
|
+
Operating Expenses
|
|
521
|
+
Sales & Marketing
|
|
522
|
+
Salaries - Sales
|
|
523
|
+
Advertising
|
|
524
|
+
Travel - Sales
|
|
525
|
+
Research & Development
|
|
526
|
+
Salaries - R&D
|
|
527
|
+
Software & Tools
|
|
528
|
+
General & Administrative
|
|
529
|
+
Executive Salaries
|
|
530
|
+
Legal & Professional
|
|
531
|
+
Rent & Facilities
|
|
532
|
+
Insurance
|
|
533
|
+
Depreciation
|
|
534
|
+
─────────────────────
|
|
535
|
+
Total Operating Expenses
|
|
536
|
+
|
|
537
|
+
OPERATING INCOME (EBIT)
|
|
538
|
+
|
|
539
|
+
Other Income/Expense
|
|
540
|
+
Interest Income
|
|
541
|
+
Interest Expense
|
|
542
|
+
FX Gains/Losses
|
|
543
|
+
Other
|
|
544
|
+
─────────────────────
|
|
545
|
+
Total Other
|
|
546
|
+
|
|
547
|
+
INCOME BEFORE TAX
|
|
548
|
+
|
|
549
|
+
Income Tax Expense
|
|
550
|
+
─────────────────────
|
|
551
|
+
NET INCOME
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### DAX for P&L Matrix
|
|
555
|
+
|
|
556
|
+
```dax
|
|
557
|
+
// Sort Order for P&L display
|
|
558
|
+
P&L Sort =
|
|
559
|
+
SELECTEDVALUE(DimAccount[SortOrder])
|
|
560
|
+
|
|
561
|
+
// P&L Amount with proper aggregation
|
|
562
|
+
P&L Amount =
|
|
563
|
+
IF(
|
|
564
|
+
HASONEVALUE(DimAccount[L5_Account]),
|
|
565
|
+
[Amount],
|
|
566
|
+
SUMX(
|
|
567
|
+
SUMMARIZE(DimAccount, DimAccount[L5_Account]),
|
|
568
|
+
[Amount]
|
|
569
|
+
)
|
|
570
|
+
)
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
---
|
|
574
|
+
|
|
575
|
+
## Security Considerations
|
|
576
|
+
|
|
577
|
+
### Row-Level Security
|
|
578
|
+
|
|
579
|
+
```dax
|
|
580
|
+
// Cost Center RLS
|
|
581
|
+
[CostCenterAccess] =
|
|
582
|
+
VAR _UserEmail = USERPRINCIPALNAME()
|
|
583
|
+
VAR _UserCCs =
|
|
584
|
+
CALCULATETABLE(
|
|
585
|
+
VALUES(SecurityCostCenter[CostCenterKey]),
|
|
586
|
+
SecurityCostCenter[UserEmail] = _UserEmail
|
|
587
|
+
)
|
|
588
|
+
RETURN
|
|
589
|
+
DimCostCenter[CostCenterKey] IN _UserCCs
|
|
590
|
+
|
|
591
|
+
// Entity RLS
|
|
592
|
+
[EntityAccess] =
|
|
593
|
+
VAR _UserEmail = USERPRINCIPALNAME()
|
|
594
|
+
VAR _UserEntities =
|
|
595
|
+
CALCULATETABLE(
|
|
596
|
+
VALUES(SecurityEntity[EntityKey]),
|
|
597
|
+
SecurityEntity[UserEmail] = _UserEmail
|
|
598
|
+
)
|
|
599
|
+
RETURN
|
|
600
|
+
DimEntity[EntityKey] IN _UserEntities
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
---
|
|
604
|
+
|
|
605
|
+
## Implementation Checklist
|
|
606
|
+
|
|
607
|
+
- [ ] Define fiscal calendar (year-end, periods)
|
|
608
|
+
- [ ] Map Chart of Accounts with hierarchy levels
|
|
609
|
+
- [ ] Set sign convention for each account type
|
|
610
|
+
- [ ] Create scenario dimension with all versions
|
|
611
|
+
- [ ] Build cost center hierarchy
|
|
612
|
+
- [ ] Configure entity structure for consolidation
|
|
613
|
+
- [ ] Load historical GL data
|
|
614
|
+
- [ ] Import budget versions
|
|
615
|
+
- [ ] Create core financial measures
|
|
616
|
+
- [ ] Build variance calculations
|
|
617
|
+
- [ ] Configure RLS for cost center/entity access
|
|
618
|
+
- [ ] Test P&L, BS, and variance reports
|
|
619
|
+
- [ ] Document calculation methodology
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
## Related Resources
|
|
624
|
+
|
|
625
|
+
- [Finance Report Template](../power-bi/finance-report.md)
|
|
626
|
+
- [DAX Patterns](../../snippets/dax/)
|
|
627
|
+
- [Data Modeling Best Practices](../../skills/data-modeling/SKILL.md)
|