Hello @Vsb79,
Thank You for posting your query onto the Forum.
Well, let’s see the reason first why it was not yielding the results as per the expectations.
The reason being is, there was a bit of a contextual problem i.e., in your measure you have applied the “MAX()” function onto the “Project No” as well. So when no selections are made into the slicer, it takes the highest project number into consideration and evaluates the results, in this case since 6000 is the highest project number, it evaluated the results accordingly as per that project number.
So now, since we also need to evaluate the results, when there’re no selections made into the slicer for “Project No” and therefore, we need to ignore the context of “Project No” at that time (In the measure, I’ve commented out that line for your reference purposes). Below is the revised measure alongwith the screenshot of the final results provided for the reference -
Cumulative MonthlyPrice Measure =
IF (
HASONEFILTER ( Sheet2[Project No] ),
IF (
SUM ( Sheet2[Monthly Price] ) = BLANK (),
BLANK (),
CALCULATE (
SUM ( Sheet2[Monthly Price] ),
FILTER (
ALL ( Sheet2 ),
Sheet2[Project No] = MAX ( Sheet2[Project No] ) &&
Sheet2[Period Date] <= MAX ( Sheet2[Period Date] )
)
)
),
IF (
SUM ( Sheet2[Monthly Price] ) = BLANK (),
BLANK (),
CALCULATE (
SUM ( Sheet2[Monthly Price] ),
FILTER (
ALL ( Sheet2 ),
//Sheet2[Project No] = MAX( Sheet2[Project No] )
Sheet2[Period Date] <= MAX ( Sheet2[Period Date] )
)
)
)
)
I’m also attaching the working of the PBIX file for the reference purposes.
Hoping you find this useful and meets your requirements that you’ve been looking for.
Thanks and Warm Regards,
Harsh
Cumulative Total - Measure v/s Calculated Column - Harsh.pbix (43.9 KB)