Great news! Just one year after releasing the second edition of The Definitive Guide to DAX, we just published a new website, a new book, and a new collection of videos: the second edition of DAX Patterns!

DAX Patterns is a collection of patterns in DAX for Power BI, Analysis Services Tabular, and Power Pivot for Excel. The first edition of DAX Patterns dates back to the end of 2014, and it was based on Power Pivot for Excel. Since then, DAX has evolved with many useful features. Most importantly, Power BI hit the market, and the number of users adopting DAX grew at an exponential rate. When we published the first edition of this book, Power BI had not even been announced yet. Today, most DAX users create a Power BI solution. The new edition of DAX Patterns is thus based on the tool you love: Power BI.

We worked for more than one year on this project, and we built a platform that will be updated with new patterns and optimizations in the future. The entire library of code was rewritten from scratch; we used the latest DAX and Power BI features and adapted the code to Excel 2019 when necessary.

DAX Patterns is built upon three elements:

All the patterns are available for free on the web. No need to purchase anything… really? Yes. We know, and we like that! Let me further describe each of the three elements above and give you some “behind the scenes” information.

The new DAX Patterns

We made several choices when creating the new patterns from scratch. We surely started from the list of patterns in the first edition, but we also added new patterns and made several changes:

  • Time intelligence is by far the most widely-studied topic. Therefore, it made sense to increase the number of time-related calculations and patterns.
  • The New and returning customers pattern was an absolute hit in the first edition. That pattern is one of the largest patterns in the second edition. We increased the number of formulas and models to compute new and returning customers, because what is considered “new” and “returning” can be different from one business to the next.
  • We decided to cut out a few patterns. For example, the patterns about statistical calculations was useful back in 2015, because of the lack of statistical functions in DAX. Since then, many new functions were introduced in DAX to compute the formulas that were explained in that chapter. There is no need for that content in 2020.
  • We no longer provide code snippets. In the previous edition, most of the code was shown including placeholders for the columns that readers were likely to change. We no longer do that. We just show code that works with the examples we provide, because you often have to adapt the data model and other details in the formula. We felt this would make the code more readable and easier to use and to adapt to your model.
  • We optimized every single formula. All the code you see in these patterns was thoroughly reviewed for performance. This is not to say that these patterns are the very best. They are the best we could come up with. If you can make the code better and faster, let us know! The comment sections on the website are the right place to provide your feedback and suggestions.
  • We created a Power BI and an Excel version of each sample file. In the book, we include pictures of Power BI reports showing the results of the code, but the examples you can download are available in both formats: Power BI and Excel.
  • We increased the number of patterns, adding several that – in our experience – are likely to be useful to our readers.

The DAX Patterns website

We came up with a new design for the website. Every pattern has its own dedicated page with a description of what is it helpful for, and the formulas. You can also download the sample files for Power BI Desktop or for Excel 2016/2019. If you use Excel 2010/2013, you can still access the former version of the patterns – if available.

The website is free. The download of the sample files is free. We kindly ask you to provide your email address when you download a sample file so we can send you our newsletter every other week – this is not mandatory.

There is a comments section for every pattern. We are happy to reply to questions when the answer can be useful to other readers.

The DAX Patterns book

We created a book version of DAX Patterns – second edition. It is available in different formats: paperback, ebook, Kindle, and PDF.

If you are wondering what the differences may be between the content of the book and the content published on, we want to assure you that there are no differences. Should you purchase the book to obtain extra content? No. Access to the web site is free, where you can find the same content as what you can read in the book and download the sample files for free.

That said, if you enjoy having an offline copy of the patterns, if you enjoy having a printed version, if you would like to have it in your eBook collection, then you should purchase the book. This way, you help us keep the business up and running. We were surprised by the number of people who purchased the first edition. This motivated us to further invest into this new version of the website and the patterns. We hope the process will continue!

The DAX Patterns videos

By visiting the website, you can see that we have recorded a video for each pattern. This is where we go into more depth on how to use the patterns and how the formulas work. We created the videos to improve your productivity when you need to adapt the formula to your model. While the pattern is designed to be “copied” as-is, complex data models may require some further adjustments, and you have to understand how the pattern works in order to do that.

These videos are for sale. You can buy the entire collection, or just the pattern you want to study more in-depth. This is an additional service that many people had been asking for; we know some prefer the book, some prefer the video with additional details and explanations, and many people want both!

How to use DAX Patterns

Each pattern starts with a brief description of the business scenario; it then goes into a complete description of the solution, along with all the DAX code that needs to be implemented to solve the scenario. We kept the description of the code short, using comments inside the code to document the measures where needed.

If you want to implement a pattern in your model, we strongly suggest you read the entire pattern before implementing any code. The reason is that we sometimes present multiple solutions, and you need to choose the best for your specific scenario. For each pattern, we also provide the demo files both in Power BI and Power Pivot for Excel. Sometimes the code of the two versions is slightly different. The website and the book always present the Power BI solution, which is using the latest features of DAX at the time of printing. Some of those features – such as calculated tables – are not available in Power Pivot. This is the main reason for the differences.

There is only one exception: time-related calculations. We present four different patterns for time-related calculations. Each of these four patterns is huge. This is why we created an introduction to the time-related calculations, which aims to help you choose the right pattern for your scenario. If you need to implement time-related calculations, make sure to read that introduction first and then the full chapter covering the pattern you decide to use.


One word of advice to our readers: DAX Patterns does not teach DAX.

You are expected to already know DAX to make the best use of these patterns. Most of the patterns show advanced DAX techniques that you are welcome to study and use in your solutions. You can find a guide to learn DAX on SQLBI.

We suggest that you use these patterns with the latest version of Power BI or Excel, because DAX evolves and improves over time. We tested the patterns on Power BI June 2020, Excel 2019, and Excel for Microsoft 365 version 2006. Most of the patterns work with earlier versions of Power BI and Excel, but we cannot guarantee this because we did not thoroughly test for all the previous versions.

Behind the scenes

OK, let’s talk about the making of!

First of all, SQLBI is the book publisher. Just like the first edition, we chose to self-publish the book because we do not think that a regular publisher would be happy to print a book with content that is freely available on the web! However, we found out that obtaining a decent and readable eBook version of a technical book is no small task. Self-publishing provides us the freedom to make choices and control the production process. You probably do not have any idea of the complexities involved in getting the proper format of code samples in a book – both printed and digital. We would have preferred not to have to deal with this issue, but reviews of previous books told us we needed to pay attention to it – so we did. We hope you can be delighted with the result like we are.

It is hard to provide an exact timeline of this project because we had several false starts. However, we started to work on the current release of DAX Patterns in June 2019. The production followed the standards of a printed book: after the internal writing and review between Alberto and me, each pattern was subject to technical and editorial reviews. Only at the end of these reviews did we move the content to book and web production stage, which are necessarily separated pipelines. Managing future corrections will be an additional challenge.

We did not measure how much time we spent on each pattern. A few patterns required just a few days, whereas a pattern like New and returning customers required months of research, analysis, and optimizations. We spread the video recording over several sessions with a professional crew. We shot the first videos in October 2019, and the last session was shot in June 2020. You might notice small differences in the background due to location changes required by the Covid-19 pandemic!

As usual, the last question is: what’s next? This release does not have a calculation group implementation of the patterns. We are working on that, even though we do not have a firm deadline. We want to make sure that the performance is excellent, and a pattern is the result of many tests and analyses. Calculation groups are still relatively new, so we are building our experience for a future update. We are also working on some other content for Tabular modeling and DAX optimization, and on new tools for DAX developers and Power BI users. However, you can already spend many days or weeks studying the new DAX Patterns while we work on future content!