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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.