Press "Enter" to skip to content

Category: DAX

User-Context-Aware Calculated Columns in Power BI

Nikola Ilic digs into a new feature:

A few weeks ago, I was sitting in a session at FabCon Atlanta. It was an amazing session about Direct Lake semantic models and various optimization tips and tricks, delivered by true masters, Christian Wade and Phil Seamark (both from Microsoft). Among many fantastic topics, the one that immediately caught my attention was the new feature that Christian Wade introduced: User-context-aware calculated columns.

Although we all know that DAX calculated columns are the “last island” in what are considered recommended data modeling practices (“Roche’s Maxim”, etc.), this one still stood out for me as something that might be super useful in certain scenarios.

Read on to see how it works and scenarios in which it could be useful.

Leave a Comment

Parameter Types in DAX User-Defined Functions

Marco Russo and Alberto Ferrari talk about type systems:

In a previous article, Introducing user-defined functions in DAX, we described the syntax for creating user-defined functions, including the two passing modes (VAL and EXPR) and the fundamental parameter types SCALAR and TABLE. In this article, we build on that foundation and focus on the complete type system, with particular attention to the reference types introduced in March 2026 that provide better documentation, stronger validation, and improved IntelliSense support.

Before diving into the new types, let us briefly recap the full picture of parameter types and passing modes available in DAX user-defined functions.

Click through for a classic deep dive from Marco and Alberto.

Leave a Comment

Validating DAX against a Lakehouse via Semantic Link

Jens Vestergaard performs some checks:

A semantic model is a promise. It promises that the numbers in your reports match the data in your lakehouse. But after enough model changes, renamed columns, new relationships, and tweaked measures, that promise gets harder to verify. I wanted a way to check it programmatically.

This is my second submission to the Fabric Semantic Link Developer Experience Challenge. The first was a DAX unit test harness that compares measures against hardcoded expected values. That works well for known business rules, but it has a limitation: someone has to decide and maintain what the “right” answer is. For a model with hundreds of measures across dozens of filter contexts, that does not scale.

Click through to see what Jens did instead.

Leave a Comment

Unit Testing DAX via Semantic Link

Jens Vestergaard writes a test:

Every BI developer has felt it. You change a measure, update a relationship, or rename a column in a semantic model, and then you spend the next hour clicking through report pages to check if something broke. Manual spot-checking is how most teams validate DAX today. It works until it does not.

I have been building and maintaining semantic models for years. The further I get into Fabric-based development, the more my models start to feel like production code. They power dashboards that drive decisions. They feed downstream pipelines. When something breaks, the blast radius is real. And yet, the testing story has always been: deploy, open the report, squint at the numbers.

That gap bothered me enough to do something about it.

Click through to see what Jens has done.

Leave a Comment

Performing a GROUPBY in Excel

Ben Richardson explains a DAX function:

If you’ve ever built a summary table in Excel by writing five separate SUMIFS formulas – one for each region, product, or department – you’ll appreciate what GROUPBY does.

It collapses all of that into a single formula that updates automatically, sorts itself, and can even filter out rows you don’t care about.

Introduced to Microsoft 365 in late 2024, GROUPBY is one of the most practically useful additions Excel has had in years.

But it also comes with real limitations that most people gloss over.

Read on to learn more about the capability and one big catch.

Leave a Comment

Highlighting Rows in DAX via Visual Calculations

Marco Russo and Alberto Ferrari point out a row:

When it comes to visuals, users may want to specific cells highlighted in order to spot important information quickly. While browsing the forums, we came across an interesting requirement that can easily be solved with a DAX measure: highlight an entire row based on the value in the last column of the visual only. In our example, we highlight Wide World Importers because it has the maximum value (71,904.98) in the last year (2026).

I’ve had a need for this several times in the past, so it’s nice to see you can do it via visual calculations.

So, let’s use this in Power BI Report Server. Oh, wait, you can’t. But if you’re not shackled to that train wreck, click through for a nice solution.

Leave a Comment

User-Defined Functions vs Calculation Groups in DAX

Marco Russo and Alberto Ferrari take a look back at calculation groups:

The introduction of user-defined functions (UDFs) in DAX changes the way we think about code reuse. Before UDFs existed, calculation groups were the only mechanism for sharing common logic across multiple calculations. Many developers adopted calculation groups not because they were the ideal tool for code reuse, but because there was no alternative.

Now that user-defined functions are available, it is time to revisit this practice. User-defined functions and calculation groups serve fundamentally different purposes. Understanding the distinction between the two is essential for building well-organized, efficient semantic models.

Click through for a dive into these two concepts and when to use each.

Comments closed

Aggregation on a Filtered Range with SUMIFS()

Ben Richardson uses a DAX function:

Sometimes the columns have shifted, the totals row isn’t showing up, or the colour coding they used last month is gone.

This is not a pivot table problem, pivot tables are excellent tools! The issue is using them for the wrong job.

If you need to explore data – rotating it, slicing it, asking “what does this look like by region?” – pivot tables are unbeatable.

But if you just need a report that always looks the same, month after month, we really recommend SUMIFS.

Click through to see an example of the function in Excel, though it also works the same way in Power BI.

Comments closed

Prevent Future Date Spillage in Power BI Visuals

Kenneth Omorodion lives in the now:

For Power BI developers, one very common (and frustrating) issue is when measures spill into future dates on charts especially when working with some time intelligence DAX calculations (e.g. MTD, YTD, etc.), date dimensions that extend beyond current date, and forecast-enabled tables.

In Power BI charts (e.g. line or bar charts), apart from dates with data, measures are also evaluated for every date on the axis, regardless if there is data or not. For example, if my dates table runs to 2026 December, but my data table only have data up to today, when I create a measure that leverages MTD or YTD for example, Power BI will tend to evaluate the measure for all dates that exist in my Dates table, unless I explicitly apply a logic to prevent this behaviour. This behaviour might result in flat lines on charts, misleading trends, and confusion to intended users.

In this article, I will demonstrate some examples of approaches to prevent or manage future dates spillage in Power BI.

Click through for some tips.

Comments closed

UDFs to Support the Like-for-Like Pattern in DAX

Marco Russo and Alberto Ferrari support a pattern:

DAX user-defined functions (UDFs) are a powerful tool for improving the quality of your semantic models. DAX authors with an IT background are accustomed to creating generic code using functions. However, many DAX creators came from different backgrounds of expertise, such as statistics, business, and marketing. They may not recognize the immense power that functions have brought to the Power BI community.

In this article, we want to practically show, through an example, how to wisely use functions to improve the generalization of code and to reduce the complexity of your semantic models, with the goal of raising curiosity towards user-defined functions and – in general – the world of code development.

Read on for an example, as well as a link to the like-for-like pattern and what it means.

Comments closed