Cover of DAX Patterns by Marco Russo and Alberto Ferrari, featuring abstract geometric shapes representing structured data patterns on a clean background

Pages

531

Published

2020

Power BI and DAX ✨ New

DAX Patterns

Reusable DAX solutions for common Power BI and Analysis Services business intelligence scenarios

Build reliable Power BI reports faster by applying proven DAX patterns to the business problems you face every week.

DAX Patterns is a practical reference for Power BI developers and data analysts who need reliable, field-tested DAX solutions without reinventing the wheel on every project. Marco Russo and Alberto Ferrari distill years of real-world consulting into a catalog of reusable patterns covering time intelligence, statistical calculations, segmentation, ranking, and more. At 531 pages, it is dense with working code, worked examples, and clear explanations of why each pattern is built the way it is.

About this book

Most DAX problems have already been solved. The challenge is knowing the correct pattern, understanding why it works, and adapting it cleanly to your data model. That is precisely what DAX Patterns delivers.

Marco Russo and Alberto Ferrari are the authors behind SQLBI, the most-cited technical resource in the Power BI community. In this book they collect the patterns they have applied repeatedly across hundreds of client engagements β€” time intelligence, ABC classification, basket analysis, budgets, running totals, survey analysis, and a dozen more. Each pattern is presented with a working DAX implementation, a clear explanation of the logic, and guidance on common variations you are likely to encounter.

The book is organized so you can read it cover to cover to build systematic fluency, or open it to the specific pattern you need today. Either way, you come away with code you can drop into a real model and explanations clear enough that you can modify it confidently when your requirements differ from the example.

What separates this book from a collection of blog posts is coherence. The patterns share a consistent style, a consistent data model for examples, and a consistent level of rigor. You learn not just what to type but why the measure is structured that way β€” which filter context it relies on, which evaluation order matters, and where the naive approach silently returns wrong numbers.

  • Time intelligence patterns covering year-to-date, prior period, moving averages, and semi-additive measures
  • Statistical patterns including percentiles, running totals, and weighted averages
  • Segmentation and ranking patterns for ABC analysis, banding, and top-N reporting
  • Financial patterns for budgets, forecasts, and currency conversion
  • Survey and Likert-scale analysis patterns built for non-additive data
  • Basket analysis and customer behavior patterns using many-to-many relationships

If you write DAX professionally β€” in Power BI, Analysis Services, or Power Pivot β€” this book shortens the gap between a business question and a correct, maintainable measure. It does not teach DAX from scratch, but it does show you what mastery looks like in practice.

🎯 What you'll learn

  • Apply time intelligence patterns β€” YTD, prior year, moving averages β€” correctly across custom fiscal calendars
  • Implement semi-additive measures such as opening and closing balances without incorrect aggregation across time
  • Build ABC classification and percentile ranking measures that perform well on large data models
  • Construct budget-versus-actual comparisons that handle sparse or non-matching date granularity cleanly
  • Analyze many-to-many relationships for basket analysis and shared dimension scenarios
  • Adapt each pattern to your own schema by understanding the filter context assumptions behind every measure
  • Avoid the silent errors that naive DAX implementations produce when context transitions behave unexpectedly
  • Structure reusable measure libraries so that patterns remain maintainable as your model grows

πŸ‘€ Who is this book for?

  • Power BI developers who know basic DAX and want a reliable reference for the scenarios that appear on every project
  • Business intelligence analysts building financial or operational reports who need time intelligence and budget comparison patterns
  • Analysis Services developers migrating models to tabular format and looking for authoritative DAX equivalents to their MDX logic
  • Data engineers who build semantic models and want to validate that their measures follow established best practices
  • Consultants and freelancers who need to deliver correct, maintainable DAX quickly across varied client data models
  • Advanced Excel users who have moved to Power BI and want to close the remaining gap in their DAX fluency

Table of contents

  1. 01

    Time Intelligence Patterns

    Covers year-to-date, quarter-to-date, prior period, and period-over-period growth measures. You learn the correct calendar table structure each pattern requires and how to adapt the measures to non-standard fiscal calendars.

  2. 02

    Semi-Additive Measures

    Explains why standard aggregations fail for balances and headcounts, then walks through the LASTNONBLANK and OPENINGBALANCEYEAR patterns. You leave with measures that aggregate correctly across all date granularities.

  3. 03

    Moving Averages and Running Totals

    Implements rolling window calculations and cumulative totals as reusable templates. You see how window size and blank-date handling affect results and how to make both patterns filter-context-safe.

  4. 04

    Ranking and Top-N Patterns

    Builds RANKX-based measures for product, customer, and category rankings, including dynamic top-N with an Others bucket. You learn to control ties and blank handling without breaking cross-filter behavior.

  5. 05

    ABC Classification and Segmentation

    Walks through assigning ABC tiers and custom bands to entities based on cumulative contribution. You implement the pattern using variables to keep the logic readable and extend it to multiple segmentation dimensions.

  6. 06

    Statistical Patterns

    Covers percentiles, weighted averages, standard deviation, and median for non-additive datasets. You adapt each formula to work correctly inside row context, filter context, and visual totals.

  7. 07

    Budget and Forecast Comparisons

    Shows how to model budget data stored at different granularities than actuals and write measures that join them without requiring a perfectly matching date spine. You handle missing periods and future dates explicitly.

  8. 08

    Currency Conversion

    Implements average-rate and end-of-period-rate currency conversion patterns that scale across multiple currencies and date grains. You learn where to store exchange rates and how measure structure affects performance.

  9. 09

    Basket Analysis and Many-to-Many Patterns

    Uses INTERSECT and CALCULATETABLE to find co-purchased products and shared customer segments across many-to-many relationships. You work through the data model choices that determine whether the pattern is correct and fast.

  10. 10

    Survey and Likert-Scale Analysis

    Addresses non-additive response data where simple SUM produces meaningless results. You build count-based and percentage-based distributions that remain accurate under any slicer combination.

Frequently asked questions

Do I need to know DAX basics before reading this book?

Yes. The book does not teach DAX syntax from the ground up. You should be comfortable writing basic measures, understanding filter context, and using CALCULATE before picking this up. The authors' earlier book, The Definitive Guide to DAX, covers those foundations.

Are the patterns specific to Power BI, or do they work in Analysis Services and Power Pivot too?

The patterns work across all tabular DAX engines: Power BI Desktop, Azure Analysis Services, SQL Server Analysis Services tabular mode, and Power Pivot for Excel. Minor function availability differences are noted where relevant.

Is the code available to download separately?

The book references sample files and DAX code through SQLBI's official resources. Check the SQLBI website directly for any companion downloads associated with this edition.

Is this book still current given how frequently Power BI updates?

The core DAX patterns covered are based on the DAX language itself, which is stable. Individual Power BI features change frequently, but the measure logic in this book remains valid. The publication date is August 2020, so verify that any patterns touching newer DAX functions are current against your version.

Is this a reference book or should I read it cover to cover?

Both approaches work. The book is organized so each chapter stands alone as a reference you can consult when a specific scenario comes up, but reading sequentially builds a more systematic understanding of how the authors think about pattern construction.

Who is this book not suitable for?

It is not suitable for readers who are new to DAX or new to Power BI. It also does not cover Power BI report design, data modeling strategy, or M query β€” the focus is strictly on DAX measure patterns.

You might also like

πŸ“¬ Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.