Forum Discussion
cumulative sum
- Anonymous1 year ago
Hi Anonymous ,
powerbidev123's reply could return the result you want. However if A1 is not 10, it will not work. I don't suggest you to use EARLIER() function, it may cause bad performance if you have large size of data.You can also try my code to create a calculated column.
B = VAR _B1 = 15 VAR _CurrentIndex = 'Table'[index] RETURN IF ( 'Table'[index] = 1, _B1, _B1 + CALCULATE ( SUM ( 'Table'[A] ), FILTER ( 'Table', 'Table'[index] > 1 && 'Table'[index] <= _CurrentIndex ) ) )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
powerbidev123's reply could return the result you want. However if A1 is not 10, it will not work. I don't suggest you to use EARLIER() function, it may cause bad performance if you have large size of data.
You can also try my code to create a calculated column.
B =
VAR _B1 = 15
VAR _CurrentIndex = 'Table'[index]
RETURN
IF (
'Table'[index] = 1,
_B1,
_B1
+ CALCULATE (
SUM ( 'Table'[A] ),
FILTER ( 'Table', 'Table'[index] > 1 && 'Table'[index] <= _CurrentIndex )
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.