The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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])
)
It seems to be the DAX:
how can I spot the specific line taking the longest...
and it finishes like:
Hi @Anonymous ,
I recommend that you go to DAX studio or Performance Analyzer to check the time spent on DAX.
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.
User | Count |
---|---|
10 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
21 | |
14 | |
14 | |
9 | |
7 |