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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

dax measure taking long time...

I have my measure working, but takes long time to calculate. I asusme its because they are calling each other... 

 

My measure is:  SUM(Fact[Hours]) / ([TotalH]* [FF])

 

 

TotalH:=

VAR selectedDays = ALLSELECTED('DimDate'[Date])

RETURN

CALCULATE(IF(SELECTEDVALUE(DimUser[Code]) ="A", SUM(DimStdDates[A_StandardHours])

,IF(SELECTEDVALUE(DimUser[Code]) ="B", SUM(DimStdDates[B_StandardHours])

,IF(SELECTEDVALUE(DimUser[Code]) ="C", SUM(DimStdDates[C_StandardHours])

,SUM(DimDate[DefaultStandardHours])))))),

FILTER('DimStdDates', DimStdDates[Date] IN selectedDays))

 

 

FF:=

DIVIDE(

 'Calculations'[TotalH] * DISTINCTCOUNT(DimUser[Key])

             -

            CALCULATE(

                    SUM(Fact[Hours]),

                        FILTER(Fact, Fact[Type] = "f57"

                       

    )),

   'Calculations'[TotalH]

   * DISTINCTCOUNT(DimUser[Key])

 

)

 

 

2 REPLIES 2
Anonymous
Not applicable

It seems to be the DAX:

ovonel_0-1701167106227.png

 

 

how can I spot the specific line taking the longest...

 

ovonel_1-1701167197434.png

 

 

and it finishes like:

ovonel_2-1701167294381.png

 

Anonymous
Not applicable

Hi @Anonymous ,

I recommend that you go to DAX studio or Performance Analyzer to check the time spent on DAX.

vxiandatmsft_0-1701134449795.png

In addition, if your judgment condition is more than 5 times, it is recommended to use a switch instead of multiple if, which will not only make the code readable, but also reduce the CPU load.

Best Regards,

Xianda Tang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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