Build the practice model¶
The model is small enough to inspect by hand. It uses Import mode, one demonstration currency, and one row per sales transaction line. These assumptions matter when adapting formulas to a real model.
1. Import three CSV tables¶
Download the example package, or get the source dataset. In Power BI Desktop select Get data > Text/CSV for each file, use comma delimiter/UTF-8 headers, and name the tables Sales, DimProduct, and DimRegion exactly.
In Power Query verify types rather than relying on automatic detection:
- SaleID, ProductKey, Quantity: Whole number.
- OrderDate and ShipDate: Date, not text or mixed timestamps.
- UnitPrice, UnitCost, SalesAmount, CostAmount: Fixed decimal number.
- Region, ProductName, Category: Text.
Apply the transformations. Confirm 12 Sales rows, 3 product rows, and 2 region rows. Each dimension key must be unique and nonblank. SalesAmount equals Quantity * UnitPrice; CostAmount equals Quantity * UnitCost.
2. Create the date table¶
Use Modeling > New table:
DimDate =
ADDCOLUMNS (
CALENDAR ( DATE ( 2025, 1, 1 ), DATE ( 2026, 12, 31 ) ),
"Year", YEAR ( [Date] ),
"MonthNumber", MONTH ( [Date] ),
"Month", FORMAT ( [Date], "MMM" ),
"YearMonth", FORMAT ( [Date], "yyyy-MM" ),
"YearMonthSort", YEAR ( [Date] ) * 100 + MONTH ( [Date] )
)
Mark DimDate as the date table using [Date] for this guide's classic
time-intelligence functions. The table must have 730 unique, nonblank,
continuous dates. Sort Month by MonthNumber and YearMonth by YearMonthSort.
The date range is deliberately fixed to the synthetic dataset, not a
universal production calendar or a fiscal-year definition.
3. Set relationships explicitly¶
Delete unexpected auto-detected relationships before adding these:
| One side | Many side | State | Direction |
|---|---|---|---|
| DimProduct[ProductKey] | Sales[ProductKey] | Active | Dimension -> Sales |
| DimRegion[Region] | Sales[Region] | Active | Dimension -> Sales |
| DimDate[Date] | Sales[OrderDate] | Active | Dimension -> Sales |
| DimDate[Date] | Sales[ShipDate] | Inactive | Dimension -> Sales |
flowchart LR
P["DimProduct: one row per product"] -->|"ProductKey, active"| S["Sales: one transaction line"]
R["DimRegion: one row per region"] -->|"Region, active"| S
D["DimDate: 730 continuous dates"] -->|"OrderDate, active"| S
D -.->|"ShipDate, inactive"| S
Do not enable bidirectional filtering just to hide a wrong result. Inspect cardinality, matching data types, and the intended filter path instead. Disable auto date/time for this practice file and use fields from DimDate.
4. Choose query-only or saved-measure practice¶
Fast path: download a model-ready query.
It contains DEFINE MEASURE definitions generated from the canonical files.
Run the complete file against this model; no saved measures are required.
Report path: create the measures from the catalog in its listed dependency order. Set Revenue/Cost/Profit formatting to your chosen demonstration currency, ratio measures to Percentage, and Units/Count to whole numbers. Formatting does not change their underlying values.
The optional Line Profit source is a calculated column on Sales, not a replacement for a filter-sensitive margin measure.
5. Verify the baseline¶
Run the totals and check queries. Revenue 9500, Cost 6420, Profit 3080, Units 62, Transactions 12. A North-only region filter returns Revenue 4100.
For an unfiltered validation query, keep report slicers/page filters out of the query context. Unexpected totals are often a model/context issue rather than an arithmetic typo. Inspect troubleshooting.
Cleanup: save the practice file locally if wanted, then close it. No cloud resources need deletion. Do not apply model/role experiments to production. Reference: star-schema guidance and date tables.