โ† Back to Catalog
๐Ÿ›๏ธ
PUZZLE

Calc Groups Cathedral

Replace 12 redundant time-intelligence measures with one elegant Calculation Group on a real Direct Lake semantic model. Earn the rank of Cathedral Builder.

Difficultyโญโญโญ Advanced
Deploy Time~3 min
Complete Time~60 min
Statusโœ… Ready ยท v1.0.0
"An apprentice writes a measure for every KPI variation. A master architect carves one calculation group and lets the cathedral build itself."

๐Ÿ“‹ Overview

You are the Chief Architect of the Vertipaq Cathedral. Twelve KPI pillars need to live on a real Direct Lake semantic model: Current, LastYear, YoY, YoY%, YTD, MTD, QTD, Rolling12, BestMonth, %OfYear, AvgDailySales, DistinctCustomers.

The apprentice's way: 12 measures, each one re-typing the same SUM(Sales[Amount]). The architect's way: 1 base measure + 1 Calculation Group with 11 items (DistinctCustomers stays standalone โ€” it changes the aggregation, not the time context). Every submission is graded for correctness on 3 contexts and rewarded with an elegance score that penalizes long DAX, redundant CALCULATE, and unnecessary FILTER / SUMX.

๐Ÿš€ Quick Start

# In any Fabric notebook
%pip install -q fabric-arcade

from fabric_arcade import arcade
arcade.install("calc-groups-cathedral", workspace="My Workspace")
# Provisions: Cathedral_LH (Lakehouse), Cathedral_EH (Eventhouse + CathedralEvents table),
#             01_Setup, 02_Quest, 03_Check, 04_Dashboard notebooks.

Then in the new workspace: open 01_Setup and run it once (synthetic data โ†’ Lakehouse โ†’ Direct Lake Cathedral_Model with the seed measure). Open 02_Quest, build your pillars on Cathedral_Model, then run 03_Check to submit. Track progress in 04_Dashboard.

๐Ÿงฉ How You Play

  1. ๐Ÿ“– 01_Setup generates 3 years of synthetic Sales/Date/Customer/Budget and builds Cathedral_Model with the seed measure [Sales Amount Seed] = SUM(Sales[Amount]).
  2. ๐Ÿ“œ 02_Quest shows the 12 pillar specs and the Final Challenge brief.
  3. โœ๏ธ Open Cathedral_Model in the Fabric web UI (or use sempy-labs from any notebook) and author measures M_01_Current โ€ฆ M_12_DistinctCustomers.
  4. ๐Ÿ›๏ธ Build the calculation group 'Time Intelligence'[Calc] with 11 items wrapping SELECTEDMEASURE().
  5. โš–๏ธ Run 03_Check โ€” it evaluates each pillar via DAX on 3 contexts, scores elegance, assigns rank, and ships PillarPassed / PillarFailed / RankPromoted events to KQL.
  6. ๐Ÿ“Š 04_Dashboard renders a live Plotly view of your run: state, timeline, measures vs calc group, session recap.

๐Ÿ“ฆ What Gets Installed

The semantic model Cathedral_Model is built at runtime by 01_Setup (via sempy-labs / TOM), so it does not appear in the install plan โ€” but it is created in the same workspace as part of the first run.

๐Ÿ“ The 12 Pillars

M_01
Current
Base measure: SUM
M_02
LastYear
SAMEPERIODLASTYEAR
M_03
YoY
Current โˆ’ LY
M_04
YoY %
DIVIDE(YoY, LY)
M_05
YTD
DATESYTD
M_06
MTD
DATESMTD
M_07
QTD
DATESQTD
M_08
Rolling 12
DATESINPERIOD -12 months
M_09
Best Month
MAXX over months
M_10
% of Year
ALL ratio
M_11
Avg Daily Sales
AVERAGEX over dates
M_12 โ€” STANDALONE
Distinct Customers
DISTINCTCOUNT โ€” different aggregation, stays outside the calc group

๐Ÿ›๏ธ The Final Challenge โ€” One Calc Group, 11 Items

Collapse pillars 1 through 11 into a single Calculation Group:

// table 'Time Intelligence', column [Calc], 11 calc items
// Each item wraps SELECTEDMEASURE() โ€” applies to any base measure
Current     = SELECTEDMEASURE()
LastYear    = CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))
YoY         = SELECTEDMEASURE() - CALCULATE(SELECTEDMEASURE(), SAMEPERIODLASTYEAR('Date'[Date]))
YoYPct      = DIVIDE(/* YoY */, /* LY */)
YTD         = CALCULATE(SELECTEDMEASURE(), DATESYTD('Date'[Date]))
MTD         = CALCULATE(SELECTEDMEASURE(), DATESMTD('Date'[Date]))
QTD         = CALCULATE(SELECTEDMEASURE(), DATESQTD('Date'[Date]))
Rolling12   = CALCULATE(SELECTEDMEASURE(), DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH))
BestMonth   = MAXX(VALUES('Date'[MonthNum]), SELECTEDMEASURE())
PctOfYear   = DIVIDE(SELECTEDMEASURE(), CALCULATE(SELECTEDMEASURE(), ALL('Date'[MonthNum], 'Date'[Quarter])))
AvgDaily    = AVERAGEX(VALUES('Date'[Date]), SELECTEDMEASURE())

Why 11, not 12? DistinctCustomers swaps the aggregation entirely (DISTINCTCOUNT vs SUM) โ€” it isn't a time-context shift, so it belongs outside the group.

โš–๏ธ Scoring & Ranks

elegance = max(0, 100
                  โˆ’ max(0, len(dax) โˆ’ 60) * 0.4
                  โˆ’ max(0, count(CALCULATE) โˆ’ 1) * 8
                  โˆ’ count(FILTER) * 6
                  โˆ’ count(SUMX)   * 4)

score    = 50 + elegance * 0.5    # only if all 3 contexts pass
Min ScoreRank
0Stonemason
300Apprentice
700Journeyman
1100Architect
1500Master Architect
1800๐Ÿ† Cathedral Builder

๐Ÿ“Š Telemetry โ†’ CathedralEvents

PillarSubmitted PillarPassed PillarFailed CalcGroupSubmitted CalcGroupPassed CalcGroupFailed CathedralComplete RankPromoted

๐Ÿ”ง Workloads

Power BI Semantic Model (Direct Lake) DAX Lakehouse Eventhouse / KQL

๐ŸŽ“ What You'll Learn

SkillPower BI FeatureLevel
Calculation GroupsTMDL calculationGroup + SELECTEDMEASURE()โญโญโญ
Calc items vs measuresTOM modelingโญโญ
Time IntelligenceDATESYTD, SAMEPERIODLASTYEARโ€ฆโญโญ
Programmatic modelingsempy-labs TOMโญโญโญ
Direct Lake semantic modelsLakehouse-backed Tabularโญโญโญ
Real-time telemetryEventhouse streaming ingestโญโญ
Model minimalismMaintainable PBI designโญโญโญ

๐ŸŽฎ Played it? Tell me!

Tried this game in your Fabric workspace? Share how it went, leave a comment, or report a ๐Ÿ› bug โ€” your feedback shapes the next level.

Made with ๐ŸŽฎ by the Fabric Community
Not affiliated with Microsoft