Press "Enter" to skip to content

Category: DAX

Calendar-Based Time Intelligence in DAX

Marco Russo and Alberto Ferrari grab a calendar:

Since its first release in 2010, DAX has had a set of time intelligence functions to simplify calculations like year-to-date, year-over-year, and so on. However, the calculations only supported the Gregorian calendar, without addressing similar requirements for other calendars, such as the 4-4-5, ISO, and many other non-Gregorian calendars. With the classic time intelligence, the columns of the Date table were unknown to the time intelligence functions, with the only exception of the date column in the Date table, typically Date[Date].

Click through to see what Marco and Alberto have come up with.

Leave a Comment

User-Defined Functions in DAX

Marco Russo and Alberto Ferrari look at a new feature in DAX:

Although DAX is a functional language, it did not previously offer the option to let users define their own functions. Starting from the September 2025 version, it is possible to define functions, which are parametrized expressions that can be reused throughout the entire semantic model. This article explains how the functions work. Watch the related video to see the user interface for defining functions.

Click through for more information, and also check out SQLBI’s DAX Lib website for a few examples of the types of user-defined functions you can create.

Leave a Comment

Using VALUES in Iterators in DAX

Marco Russo and Alberto Ferrari answer a question:

In a previous article, Choosing between DISTINCT and VALUES in DAX, we explained how to choose the proper function to iterate the unique values visible in a column in the current filter context. We suggest reading that article before starting this one, because it describes the same underlying problem. Here, we discuss whether to use VALUES in an iterator. This choice depends on the answer to this question: Do you want to include or exclude the blank row generated by an invalid relationship when iterating over the rows of a table reference?

Read on to see how the answer affects your decision.

Comments closed

Sorting a Visual by a Field Not on the Visual

Nikola Ilic does a bit of sorting:

Recently, I was dealing with a Power BI report where the client had a very specific requirement – to sort the data in the visual based on a particular field from the semantic model. The only “issue” was that this particular field wasn’t part of the visual. So, while figuring out how this can be accomplished (because, yes, everything can be accomplished when the client needs it, hehe), I decided to write it down and share it with everyone who might find it useful.

Nikola successfully uses machine trickery to solve the problem.

Comments closed

Using the DAX FILTER Function

Ben Richardson digs into a function:

If you’ve ever tried to build a measure that needed more filtering power than a basic slicer, you’ve probably hit a wall.

That’s where DAX’s FILTER function comes in.

While visual filters and slicers work great for basic scenarios:

FILTER gives you row-level control to create sophisticated calculations that respond dynamically to your business logic.

Click through for an explanation of the function, as well as several examples of how it works.

Comments closed

Sideways Recursion in DAX Calculation Groups

Marco Russo and Alberto Ferrari’s example goes sideways:

DAX calculation items do not provide full recursion. However, a limited form of recursion is available, known as sideways recursion. We describe this complex topic through examples. Let us start by understanding what recursion is and why it is essential to discuss it. Recursion may occur when a calculation item refers to itself, resulting in an infinite loop within the application of calculation items (read the linked article in case you are not familiar with the concept of “application”, which is different from “execution”). Let us elaborate on this.

Read on for a demonstration of the principle. I haven’t dug into the topic, but I was curious because I’d never heard of “sideways recursion” before. It turns out that there’s some discussion of it in the DAX community and there was something known as Simpson’s sideways recursions from the 1980s, but I’m not sure if that’s the same thing.

Comments closed

Recommendations around SUMMARIZECOLUMNS

Marco Russo and Alberto Ferrari share some thoughts:

SUMMARIZECOLUMNS is the most widely-used function in Power BI queries. An important and unique feature of SUMMARIZECOLUMNS is that it determines automatically how to scan the model to produce its result. Indeed, when using SUMMARIZEGROUPBYADDCOLUMNS, or any of the more basic querying functions, developers must declare the source table to perform the grouping, as well as the group-by columns and the measures to add to the result. On the other hand, SUMMARIZECOLUMNS requires only the group-by columns; there is no need to provide the source table, which is the primary ingredient of any query. SUMMARIZECOLUMNS figures out the structure of the result by itself, using a sophisticated algorithm that requires some understanding.

The pair do have a whitepaper available on their premium (paid) service but even the free post contains a lot of detail you’ll want to check out if you use DAX.

Comments closed

Tips and Tricks with ALLSELECTED in DAX

Marco Russo and Alberto Ferrari take us through a complicated function:

ALLSELECTED is among the most complex functions in the whole DAX language. ALLSELECTED is the only DAX function that leverages shadow filter contexts. Moreover, ALLSELECTED has a slightly different behavior when used in SUMMARIZECOLUMNS or inside an iterator. Using ALLSELECTED with SUMMARIZECOLUMNS mostly produces the expected result, whereas using ALLSELECTED inside an iterator can produce weird results. Mixing the two techniques is the perfect recipe for a problematic report!

In this article, we briefly describe ALLSELECTED features in both scenarios (SUMMARIZECOLUMNS and iterators), and then we provide the best practices about the function, showing an example where mixing the two behaviors produces an unexpected result.

Read on to learn more.

Comments closed

Month-over-Month and Year-over-Year Calculations in Power BI

Boniface Muchendu does a bit of comparison:

Power BI variance measures are essential for delivering actionable insights through dynamic comparisons like month-over-month (MoM) and year-over-year (YoY) performance. This guide shows how to build flexible, filter-aware DAX measures and apply them within clean, user-friendly visuals to enhance your reports.

Click through to see them in action.

Comments closed

DISTINCT vs VALUES in DAX

Marco Russo and Alberto Ferrari compare two keywords:

When you begin modelling in DAX, DISTINCT and VALUES often appear interchangeable: both return the list of unique values for a column in the current filter context. In a clean development model, they behave the same, so it is easy to pick one at random – or worse, swap between them without thinking.

However, they are not identical. The subtle difference is crucial in production models that may one day contain invalid relationships or bad data

Read on to see how each works and how they differ in practice.

Comments closed