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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

DAX performance in IF statements

Hi,

 

I am having an issue with some heavy measure to compute. I made some tests and realized that a lot of computing time is lost when it's not necessary.

Let's take this simple measure :

Test = SUMX(SUMMARIZE(NAOSCUBE;COUNTRY[CTRY ESSB];GAMME[RANGE]);IF([Multi Bus];[Test2];0))

The goal is to iterate over each row of my summarized data table and evaluate a condition. What is strange is that when I filter my page on a zone (several countries) which I know none have the [Multi Bus] condition to true it take the same time. If replace the [Test2] measure by 1 for example then the result is immediate although there were no rows at all for which the condition was true. It looks like the engine is evaluating the measure [Test2] in the IF wheter or not the condition is true.

 

Am I missing something here ?

1 ACCEPTED SOLUTION

Hi @Anonymous ,

I think these performance issue should related to nested measures invoke and iterator functions.

HasMultiBus: it will loop whole SCT and business tables.

Mix 2: it will calculation through Data, CTRL, 'PLAY' tables.

For test if2 measure, each row calculation will invoke above measures and loop each row of correspond tables and filter by their relationship. Obviously, these calculations will spend huge amount of system resource and cause the performance issues.

I'd like to suggest you take a look at following blogs to know how to deal with that scenario:

Optimizing nested iterators in DAX

Optimizing DAX expressions involving multiple measures

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Anonymous ,

It is hard to test/coding formula without any detail sample data. Can you please share some sample data?

How to Get Your Question Answered Quickly

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Hi,

 

Thanks for your feedback.

I try to reproduce a dummy dataset which is way more simple than mine, still there is some data. I made the strick minimum and try to add some measure that behave like mines.

 

I can reproduce the issue but as the dataset is simpler the time to compute is really small. You can try to measure (I use dax studio) the time for the server to compute the Test IF & the Test IF2 measures. You will see that TEST IF2 is 2/3 times faster even when you select a zone in which no countries have the "HasMultiBus" to true.

 

Please do not investigate the Mix measure, I tried to reproduce heavy computation, not something actually accurate.

 

.pbix file

Hi @Anonymous ,

I think these performance issue should related to nested measures invoke and iterator functions.

HasMultiBus: it will loop whole SCT and business tables.

Mix 2: it will calculation through Data, CTRL, 'PLAY' tables.

For test if2 measure, each row calculation will invoke above measures and loop each row of correspond tables and filter by their relationship. Obviously, these calculations will spend huge amount of system resource and cause the performance issues.

I'd like to suggest you take a look at following blogs to know how to deal with that scenario:

Optimizing nested iterators in DAX

Optimizing DAX expressions involving multiple measures

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.