Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
j_78
New Member

Quick calculation of a waterfall using multiple measures

Hi everyone! 👋

It's been a few months since I discovered DAX, but I'm coming to you because I'm struggling with the creation of a visual, with a bad execution time for the moment.

Context:

I have created several complex metrics (to do a financial analysis by breaking down effects), but I am satisfied with the execution time (3 seconds max). Let's call them [Value1], [Value2], ..., [Value 14].

Objective:
I would like to create a waterfall chart from these measures. To do so, I followed the proposal of this link, by creating a workaround in DAX formula and a control table.

This gives the following measure:

 

    SWITCH (
        SELECTEDVALUE ( Table1[Index] ),
        1, [Value 1],
        2, [Value 1],
        3, [Value 1],
        ...,
        14, [Value 14],
        BLANK()
    )

 

Problem encountered:
I can make the desired waterfall. But the computation time is very long (around 30 seconds), whereas I can make appear in cards in less than 3 seconds all the measures I want to make appear in this waterfall.

Could you please give me some advice to improve the performance of my formula to create my waterfall (my hunch is that every measure is recalculated in my formula for the waterfall, resulting in an explosion of execution time)?

Thanks for your help! 🙂

(I can provide a file with anonymized data if my explanations are not clear)

2 REPLIES 2
j_78
New Member

Thank you very much @AlexisOlson for your help.

I think I have understood, on a technical level - thanks to your file and the documentation provided - what to do. I'll try to implement this on my file and let you know when it's done!

Jacques

AlexisOlson
Super User
Super User

There's a somewhat complicated way to do this with calculation groups that tends to be significantly better performance-wise.

 

For background, I recommend reading the following:
https://data-goblins.com/power-bi/measure-selection

https://www.sqlbi.com/articles/using-calculation-groups-to-selectively-replace-measures-in-dax-expre...

 

I'm attaching a pbix where I've implemented this as described in the above articles along with a slightly simpler method that works as follows:

 

Define a new Calculation Group with each calculation item Value 1 = [Value 1], Value 2 = [Value 2], etc.

AlexisOlson_0-1673392400963.png

^^ Tabular Editor 2 ^^

 

You can drag them around to sort the order and it automatically creates an ordinal column for sorting. That starts at 0 though, so you can define a calculated column on the CalcGroup table as CalcGroup[Ordinal] + 1.

AlexisOlson_1-1673392564366.png

 

Now define the measure to replace your switching measure as

CALCULATE ( [DummyMeasure], CalcGroup )

It doesn't matter what measure you put in the first argument because it gets replaced when you use CalcGroup as filter context.

 

Now use the CalcGroup index and this new measure in your waterfall chart.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.