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.
` I am trying to calculate the number of children enrolled in each campus per date, but I would like for the latest value to roll over until there is new enrollment data to be calculated. For example, campus 1 has enrollment data for 9/29 & 9/30, but not for 10/1. Instead of a zero value, I would like to write a measure that would calculate the enrollment sum for the latest date available. So the values for 10/1 & 10/2 would be 728 until 10/3, where the latest value would be 729.
I have included the matrix with the results I am getting for the enrollment data and the DAX measure. The matrix rows use the campus from the campus table and the dates from the dates table. The values [Enrollment] is the measure I have attached. All the examples I’ve seen online use only one table, but I am using the dates table so it's been difficult getting an exact example.
NOTE: Also I just want to make it clear I am not asking for a cumulative or rolling sum. Just the sum of the latest date where there is enrollment data.
Solved! Go to Solution.
Hi, @MickyG
You can try the following methods.
Column:
Column = IF([Value]=0,BLANK(),[Value])
Column2 = CALCULATE (
LASTNONBLANK('Enrollment Data'[Attendance Date],1),
FILTER (
'Enrollment Data' ,
[Attendance Date] <= EARLIER ( 'Enrollment Data'[Attendance Date] )
&&[Column]<>BLANK()))
Column 3 =
CALCULATE(MAX('Enrollment Data'[Value]),FILTER('Enrollment Data',[Attendance Date]=EARLIER('Enrollment Data'[Column2])))
Result:
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @MickyG
You can try the following methods.
Column:
Column = IF([Value]=0,BLANK(),[Value])
Column2 = CALCULATE (
LASTNONBLANK('Enrollment Data'[Attendance Date],1),
FILTER (
'Enrollment Data' ,
[Attendance Date] <= EARLIER ( 'Enrollment Data'[Attendance Date] )
&&[Column]<>BLANK()))
Column 3 =
CALCULATE(MAX('Enrollment Data'[Value]),FILTER('Enrollment Data',[Attendance Date]=EARLIER('Enrollment Data'[Column2])))
Result:
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey @MickyG ,
try to use the DAX function LASTNONBLANKVALUE: LASTNONBLANKVALUE – DAX Guide
Hopefully, this provides an idea on how to solve this.
Regards,
Tom
I previously looked into this and I'm getting the same result. This is the formula I'm using. Not sure what I'm doing incorrectly?
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 |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |