Power BI DAX Pattern Library
100+ DAX patterns for time intelligence, dynamic filtering, ranking, budgets vs actuals, and advanced calculations.
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 18 files
📖 Documentation Preview README excerpt
Power BI DAX Patterns Library
100+ production-ready DAX patterns organized by category. Each pattern includes the complete DAX formula, an explanation of how it works, and guidance on when to use it.
What's Included
- Time Intelligence (15 patterns) — YTD, QTD, MTD, prior periods, rolling windows, fiscal calendars
- Dynamic Filtering (12 patterns) — Slicers, what-if parameters, dynamic Top N, segmentation
- Ranking (10 patterns) — Top/Bottom N, percentiles, dense ranks, running ranks
- Budget vs Actuals (10 patterns) — Variance analysis, forecast accuracy, target tracking
- Running Totals (8 patterns) — Cumulative sums, running averages, progressive calculations
- Semi-Additive Measures (8 patterns) — Balance-at-date, inventory, headcount, snapshots
- Parent-Child Hierarchies (8 patterns) — Org charts, category trees, path functions
- Advanced Calculations (15 patterns) — ABC analysis, basket analysis, cohort retention, statistical
- Statistical (8 patterns) — Standard deviation, correlation, regression, outlier detection
- Text & Formatting (6 patterns) — Dynamic titles, conditional formatting, number formatting
- Table Manipulation (6 patterns) — Virtual tables, SUMMARIZE, ADDCOLUMNS, GENERATE
How to Use
1. Find the pattern that matches your business requirement
2. Copy the DAX formula
3. Replace table and column names with your model's names
4. Test with a known data subset to verify correctness
Requirements
- Power BI Desktop (any recent version)
- A proper date table with
MARK AS DATE TABLEapplied - Star schema data model (fact + dimension tables)
File Format
Each .dax file contains multiple related patterns. Each pattern follows this format:
-- ═══════════════════════════════════════════
-- Pattern: [Name]
-- Category: [Category]
-- When to use: [Scenario description]
-- ═══════════════════════════════════════════
[Measure Name] =
[DAX Formula]
/* HOW IT WORKS:
[Step-by-step explanation]
*/
License
MIT License — See LICENSE file.
Part of [Data Analyst Toolkit](https://datanest-stores.pages.dev/data-analyst/)
📄 Content Sample guides/dax-best-practices.md
DAX Best Practices Guide
Field-tested rules for writing maintainable, performant DAX measures.
Measure Organization
Naming Convention
| Type | Pattern | Example |
|---|---|---|
| Base measure | Total {Noun} | Total Revenue, Total Orders |
| Rate/Percentage | {Noun} % or {Noun} Rate | Conversion Rate, Margin % |
| Comparison | {Metric} {Period} | Revenue Prior Year, Revenue YTD |
| Growth | {Metric} {Period} Growth | Revenue YoY Growth |
| Conditional | {Metric} ({Condition}) | Revenue (New Customers) |
| Helper/Hidden | Prefix with _ | _Filtered Revenue Base |
Display Folders
Organize measures into folders in the model:
Revenue/
├── Total Revenue
├── Revenue YTD
├── Revenue MTD
├── Revenue Prior Year
└── Revenue YoY Growth
Customers/
├── Unique Customers
├── New Customers
├── Returning Customers
└── Customer Retention Rate
Targets/
├── Budget Amount
├── Variance to Budget
├── Budget Attainment %
└── Budget Status
Performance Rules
1. Variables Prevent Repeated Calculation
-- BAD: Calculates [Total Revenue] twice
*... and much more in the full download.*