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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Do not evaluate else part of IF function if the condition is met

Hi Community,

 

I am facing some issues with the performance of the DAX code and it seems like I have found a bottleneck for it. 

 

Just for a background, in my reports, I show values for companies and for benchmarks. The benchmark logic is quite complex and has to compute more data than simply selected companies, that is why the default state of a report is only selected companies so that it will open up fast and then the user can select a benchmark additionally. 

 

All companies have positive number IDs and all benchmarks have negative number IDs. That's how we distinguish then. 

So, I have an IF function inside my DAX like this: 

IF(ID>0, [simple logic for comapines], [complex logic for benchmarks]). 

The formula itself works perfectly fine, however, even when we only looking at the selected companies the time for compution is still the same as it would've been for benchmarks. When I remove the else statement the loading time is less than 5 seconds, but when I add it back, even though the condition ID>0 is true and else statement should not be evalueated the loading time grows to 10-15 seconds. 

I have read it moght be because the eager evaluatio taking place, so we need to somehow trigger the strict evaluation so that only the first part of DAX is evaluated, but I could not fine a way to do it. 

I would appreaciate any ideas regardinf this. 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , if this is column, then not having else means some rows will not be evaluated hence less time.

 

If this is measure try like

calculate([Simple logic], filter(Table, Table[ID] >0) ) + calculate([Complex logic], filter(Table, Table[ID] <0) )

 

 

if the result is text use & in place of +

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

thanks a lot for the idea, however, I have already tried this and it did not improve the performance 😞 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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