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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors