Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 37 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |