Forum Discussion
M4r3
4 years agoFrequent Visitor
Calculate cummulative value until condition
Hello community! I am trying to calculate some cummmulative values in DAX, but would like to stop the calculation after a certain condition. My measure looks like this: Sum X Quarters ...
M4r3
4 years agoFrequent Visitor
I have solved the issue, but it is more static than I would like it to be. I still have two problems:
Sum X Quarters =
VAR xQuarters = SELECTEDVALUE('Claim Development Quarters'[Claim Development])
VAR xDates = SELECTEDVALUE('Claim Occured Date'[Claim Occured Date])
VAR Result =
CALCULATE(
[Total claims],
Triangle[TIME_UNITS_DELAY] <= xQuarters,
Triangle[TIME_CLAIM_OCCURED] = xDates
)
RETURN
IF(xDates + ((xQuarters + 1) * 90 ) < DATE(2022,6,30) , Result, 0)
I would like to add the number of quarters more dinamically (or correctly), replacing the expression:
((xQuarters + 1) * 90 )
And would like to have the MAX date instead of:
DATE(2022,6,30)
If I replace this expression with:
MAX('Claim Development Quarters'[Claim Development])
This happens:
I tried the FORMAT, but received no good results. Probably also due to my missunderstanding. The end result with 'static' code looks like: