Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi expert!
I have a measure performance problem to calculate a running total.
First Measure:
First is, i have a total man days calculation. Function of this measure is to count [Leave Entitlement];
*Leave entitlement consist of: annual leave (AL), Emergency leave (EL) and so on.
Total Man days = COUNTA( 'Leave Table'[Leave Entitlement] )
Second Measure:
This measure is to calculate running totals of man days or i called cumulative of total man days.
Cumulative Total Man Days =
VAR maxDate = MAX('Calendar'[Date])
VAR result =
CALCULATE(
[Total Man Days],
FILTER(
ALL('Calendar'[Date]),
'Calendar'[Date] <= maxDate
)
)
RETURN result
What happen when i implemented the second measure inside a visual?
Its worked, but Its load very very very slow. Can someone tell me why?
*In visual below, i take second measure over [date]
Hi @New_be ,
Your formula looks quite simple. You could try to modify the second formula as below and see if there's any improve to the speed.
Cumulative Total Man Days =
VAR maxDate = MAX('Calendar'[Date])
var tmp_table = FILTER(ALL('Calendar'[Date]),'Calendar'[Date] <= maxDate)
VAR result =
CALCULATE(
[Total Man Days],
tmp_table
)
Best Regards,
Jay
Have you used tried the changes I suggested?
Another option would be to use week or month in the axis to reduce the number of calcs
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Not yet because currently im focusing on the other report. After i try your measure, i will let you know. Big thanks @AlB 😊
Hi @New_be
I don't see any glaring issue with your code.
1) Can you share the pbix by any chance?
2) What are you using in the x-axis of the chart, Calendar[Date]?
3) Why are you using COUNTA instead of COUNT. Try these changes:
Total Man days = COUNT( 'Leave Table'[Leave Entitlement] )
Cumulative Total Man Days =
VAR minDate =
MINX ( ALL ( 'Calendar'[Date] ), 'Calendar'[Date] )
VAR maxDate =
MAX ( 'Calendar'[Date] )
VAR result =
CALCULATE (
[Total Man Days],
DATESBETWEEN ( 'Calendar'[Date], minDate, maxDate )
)
RETURN
result
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Sorry i cannot share my report.
Yupp. I dont see any issue with my code either. For X-axis, i use date.
BTW, thanks for for remarks! really appreciate it 😊
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
105 | |
79 | |
69 | |
62 |
User | Count |
---|---|
142 | |
105 | |
103 | |
85 | |
70 |