Unit Testing DAX w/ Semantic Link
Semantic Model Test Harness: Unit & Regression Testing for DAX
No one likes finding out a DAX measure broke because someone renamed a column last Tuesday. This notebook brings unit testing to semantic models in Microsoft Fabric.
You define test cases as rows in a DataFrame: the measure name, a filter context, and the expected value. The harness builds EVALUATE ROW(...) queries, sends them to your model via Semantic Link Labs' evaluate_dax_impersonation, and reports pass/fail with full traceability (actual vs. expected, the exact DAX query used).
What it does:
- Runs parameterized DAX tests against any Fabric semantic model
- Handles filter context quoting (single vs. double quotes) automatically
- Supports both boolean filters and table function expressions in CALCULATE
- Catches and logs errors instead of failing silently
- Produces a results DataFrame suitable for CI/CD pipeline integration
Built for BI developers and data engineers who want to validate business logic after model changes without opening a browser and eyeballing report pages. Drop the notebook into your workspace, define your tests, run it before or after deployments.
Requires: Microsoft Fabric workspace, a published semantic model, and the sempy_labs (Semantic Link Labs) package.
https%3A%2F%2Fgithub.com%2Fvestergaardj%2FSemantic-Link-TestHarness%2Fblob%2Fmain%2F2026_SemanticLink_vestergaardj_TestHarness.ipynb