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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

visual takes minutes to load

Hi,

 

My visual which has the below measure takes minutes to load... how can Improve it? 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])

 

)

 

 

 

Thanks in advance

1 REPLY 1
adudani
Super User
Super User

Hi @Anonymous ,
let me know if this works:

 


TotalH:=

VAR selectedDays = ALLSELECTED('DimDate'[Date])
VAR A=SUM(DimStdDates[A_StandardHours])
VAR B=SUM(DimStdDates[B_StandardHours])
VAR C= SUM(DimStdDates[C_StandardHours])
VAR D= SUM(DimDate[DefaultStandardHours])
RETURN

CALCULATE(
    SWITCH(
        TRUE(),
        SELECTEDVALUE(DimUser[Code]) ="A",A,
        SELECTEDVALUE(DimUser[Code]) ="B", B,
        SELECTEDVALUE(DimUser[Code]) ="C", C,
        D),
            FILTER('DimStdDates', DimStdDates[Date] IN selectedDays)
         )

 

FF:=
var dcuser= DISTINCTCOUNT(DimUser[Key])
var hours = SUM(Fact[Hours])
var hourscalc = CALCULATE(
                    hours,
                    Fact[Type] = "f57")
var output=
DIVIDE('Calculations'[TotalH] * dcuser -hourscalc,'Calculations'[TotalH]* dcuser)

 return output

 

Would you be able to share sample data (mask  what is necessary) and expected output, incase this doesn't resolve the issue?

 

TIA,

 

Avinash

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a Kudos 🙂
Kind Regards,
Avinash

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.