Forum Discussion
mhrkhader01
Helper I
5 years agoI Need a Measure not a Power Query Formula - Accumulative column
Dear Team suppose we work in sales, every month there is a target, for one of the Month, if you exceed the target, then i need to save this increase in Accumulative column. lets take example **...
- 5 years ago
Hi mhrkhader01 ,
You can try the next option:
Create these measures:
#Accum = VAR currentDate = SELECTEDVALUE ( T[Date] ) VAR sumAmt = CALCULATE ( SUM ( T[Diff] ), FILTER ( ALLSELECTED ( T ), T[Date] <= currentDate ) ) RETURN sumAmt#AccumFiltered = VAR currentDate = SELECTEDVALUE ( T[Date] ) VAR firstDatValue = MINX ( ALLSELECTED ( T ), T[Date] ) VAR minValue = MINX ( FILTER ( T, T[Date] = firstDatValue ), T[Diff] ) VAR sumAmt = CALCULATE ( SUM ( T[Diff] ), FILTER ( ALLSELECTED ( T ), T[Date] <= currentDate ) ) VAR minOfSum = MIN ( 0, MINX ( FILTER ( ALLSELECTED ( T ), T[Date] <= currentDate ), [Accum] ) ) RETURN IF ( currentDate = firstDatValue && minValue < 0, sumAmt - minValue, sumAmt - minOfSum )If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
- 5 years ago
You can use MAX instead of SELECTEDVALUE .
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
ERD
Community Champion
5 years agoI believe this can be achieved by using Calculation groups.
Here is what you can read on this: https://dax.guide/selectedmeasure/ (article with references).
mhrkhader01
Helper I
5 years agoDear ERD,
Thanks. But in PowerPivot, the function SELECTEDMEASURE is not available. do you have another solution?