Multiple fact grains
Compare at a shared grain
Grain tells what a fact row represents. Sales contains lines at day/product grain; Budget holds a monthly category target. Both can be compared at month/category grain, but a target is not a line amount. Use conformed dimensions: DimMonth (unique MonthKey) and DimCategory (unique CategoryKey) have the same business definitions for both facts. In a separate comparison model, connect each dimension directly to both facts with active one-to-many, single-direction relationships. Derive Sales[MonthKey] from OrderDate and Sales[CategoryKey] from the validated product mapping. DimProduct can filter Sales only; it must not also filter Budget through a hidden or ambiguous path. Restrict the comparison page to month and category fields: do not add product/day/customer slicers or filters to budget comparisons. The model intentionally does not allocate targets to finer grains. For an unrestricted production model, implement and test explicit measure guards for all unsupported filter paths or a documented allocation rule; neither is supplied by a relationship alone.
Example 1: why raw fact joins inflate budget
January Stationery has three sales lines worth 40, 60 and 30 USD. Its single target is 120 USD. A raw join on MonthKey and CategoryKey repeats 120 three times, falsely yielding 360 USD. It also loses January Lighting's 40 USD budget if sales are the driving inner-joined table. Instead, summarize each fact independently and combine the summaries on the common grain; include all four month/category pairs. In Power BI, use separate measures and dimensions in the matrix (rows: DimMonth and DimCategory):
Sales Revenue = SUM(Sales[RevenueUSD])Budget Amount = SUM(Budget[BudgetUSD])Budget Variance = [Sales Revenue] - [Budget Amount]Create each measure separately. The fixture has complete targets, and no sales for January Lighting; subtraction treats its blank actual as zero in this comparison. If a target is missing, show an explicit missing-target status and do not interpret a blank target as zero. Expected matrix: January C1 actual 130 / budget 120 / variance +10; January C2 no rows (blank actual) / 40 / −40; February C1 50 / 60 / −10; February C2 70 / 80 / −10. Total actual 250, budget 300, variance −50 USD. If a product filter is allowed to reach only Sales, the target stays at category/month grain: the resulting variance is misleading unless that meaning is explicitly intended. Keep budget and sales detail pages separate for this lab.
Example 2: factless coverage and inventory snapshots
promotion-coverage.csv contains the pairs A–P1, A–P2 and B–P1. The row is an eligible product-promotion combination, not a sale. Count rows for three coverage memberships; count distinct products for two eligible products. A bridge uses one row per relationship between entities, often with a unique composite key; here P1 belongs to two promotions. Never join coverage rows to sales and sum revenue across promotions as if they were exclusive. In January, P1 earns 70 USD and P2 earns 60 USD; promotion A covers 130 USD, B covers 70 USD, but the union covers only 130 USD, not 200. This is eligibility, not promotion attribution. If allocation is required, define weights and validate them independently. For inventory.csv, each row is a product's end-of-month stock. January totals 18 units, February 16 units. The ending balance is 16, not the sum 34. This periodic snapshot is additive across products at one instant but not across time for an ending-stock metric. An accumulating snapshot instead updates a process row when milestones occur (for example order placed, shipped, delivered).
Protect the comparison contract
Do not solve a grain mismatch by changing relationship cardinality until the warning disappears. A direct many-to-many relationship can be valid in specific designs but cannot invent product-level budget allocations. Require one row per MonthKey/CategoryKey in Budget, valid dimension keys, and unique LineID in Sales. Test the target-only month/category group explicitly. Hide fact keys from normal report authoring when appropriate. Use whole-month selections, one fixed currency and one target version in this fixture. Different budget versions or currencies would require additional grain keys. A zero amount is not a missing target.
Practice: reconcile a mixed-grain report
Build the four-row month/category matrix on paper or in a disposable Import model. Explain the January C1 inflation caused by a raw join. Compute combined unique promotion coverage for January and the February ending stock. Identify which lower-level filters must be excluded from the comparison page.