The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |