Examples and downloads¶
Sources are maintained once under examples/. Website builds assemble the
downloadable query DEFINE blocks from those same measure files; there is no
second hand-maintained formula library.
Prerequisite for model queries: import and relate the practice model. The standalone first query needs a DAX engine but no retail tables.
Model-ready query downloads¶
Download the complete file, including its DEFINE block. Query-scoped measures do not persist changes to your model.
| Query | Download | Expected unrestricted result / purpose |
|---|---|---|
| First query | 01-first-query.dax | Revenue 1250; default zero-division BLANK |
| Totals | 01-totals.dax | Revenue 9500; Cost 6420; Profit 3080 |
| Regions | 02-regions.dax | North 4100; South 5400 |
| Products | 03-products.dax | Laptop 8000/rank 1; Mouse 800/rank 2; Keyboard 700/rank 3 |
| Time | 04-time.dax | Four sales months; February 2026 YTD 6100 |
| Shipping | 05-shipping.dax | Six nonempty order/shipping months; March 2026 ships 400 |
| Filter intersection | 06-filter-intersection.dax | South 5400; replacement North 4100; intersection BLANK |
| Checks | 07-checks.dax | Boolean checks TRUE; Date Rows 730 |
Download all examples and CSV data
Raw queries in the repository do not repeat the DEFINE block; they expect saved measures or the generated prefix. The package includes both original sources and ready-to-run query versions with clear paths.
Measure library¶
Create saved measures in this order when building report visuals. A query-only practice path does not require installing them.
| Measure | Purpose | Canonical source |
|---|---|---|
| Revenue | Additive transaction amount | revenue.dax |
| Cost | Additive transaction cost | cost.dax |
| Gross Profit | Revenue minus Cost | gross-profit.dax |
| Gross Margin % | Aggregate profit/revenue | gross-margin.dax |
| Units Sold | Sum of quantity | units.dax |
| Transaction Count | Distinct transaction-line IDs | transactions.dax |
| Avg Transaction Value | Revenue per transaction line | average-transaction.dax |
| Revenue Iterator | Row arithmetic with SUMX | revenue-iterator.dax |
| North Revenue | Replace Region filter | north-revenue.dax |
| North Within Selection | Intersect Region filter | north-within-selection.dax |
| All Products Revenue | Remove product/category filters only | all-products-revenue.dax |
| Revenue Share All Products | Intentional all-product denominator | share-all-products.dax |
| Revenue Share Selected Products | Selected visual denominator | share-selected-products.dax |
| Revenue YTD | Classic calendar YTD | revenue-ytd.dax |
| Revenue PY | Classic prior-year revenue | revenue-py.dax |
| Revenue YoY % | Growth with an undefined-period guard | revenue-yoy.dax |
| Revenue by Ship Date | Existing inactive date relationship | ship-date-revenue.dax |
| Product Revenue Rank | Dense selected-product rank; suppress total | product-rank.dax |
Other object types¶
- DimDate calculated table: New table, then mark Date and configure relationships/sorting.
- Line Profit calculated column: New column on Sales; one stored row-level result.
- NorthReader rule: Manage roles on DimRegion; not a measure and not a substitute for service permissions.
Validation expectations¶
The dataset reference file lists independent totals. Compare them with actual engine output under the stated context. Packaging/reference tests do not establish DAX execution. See maintenance and verification.