Forum Discussion
Cumulative sum by date by condition
- 7 years ago
hi, Anonymous
After my research, you could do these as below:
First is there some errors in your expected output “Cumulative Sum”
for 02/01/2018 condition B, why one row is 30 and another is 50
but 03/01/2018 condition A, why one row is 15 and another is 25
please check the expected output “Cumulative Sum”
and I have provided two formula for you to refer to:
result 1 = CALCULATE ( SUM ( 'Table'[Sum] ), FILTER ( ALL ( 'Table' ), 'Table'[Condition] = EARLIER ( 'Table'[Condition] ) && 'Table'[Date] < EARLIER ( 'Table'[Date] ) ) ) + 'Table'[Sum]result 2 = CALCULATE ( SUM ( 'Table'[Sum] ), FILTER ( ALL ( 'Table' ), 'Table'[Condition] = EARLIER ( 'Table'[Condition] ) && 'Table'[Date] <= EARLIER ( 'Table'[Date] ) ) )Result:
here is pbix, please try it.
https://www.dropbox.com/s/wqt1qi8hphipnmk/Cumulative%20sum%20by%20date%20by%20condition.pbix?dl=0
Best Regards,
Lin
hi, Anonymous
After my research, you could do these as below:
First is there some errors in your expected output “Cumulative Sum”
for 02/01/2018 condition B, why one row is 30 and another is 50
but 03/01/2018 condition A, why one row is 15 and another is 25
please check the expected output “Cumulative Sum”
and I have provided two formula for you to refer to:
result 1 =
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER (
ALL ( 'Table' ),
'Table'[Condition] = EARLIER ( 'Table'[Condition] )
&& 'Table'[Date] < EARLIER ( 'Table'[Date] )
)
)
+ 'Table'[Sum]result 2 =
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER (
ALL ( 'Table' ),
'Table'[Condition] = EARLIER ( 'Table'[Condition] )
&& 'Table'[Date] <= EARLIER ( 'Table'[Date] )
)
)Result:
here is pbix, please try it.
https://www.dropbox.com/s/wqt1qi8hphipnmk/Cumulative%20sum%20by%20date%20by%20condition.pbix?dl=0
Best Regards,
Lin
Hi Lin,
What is the difference between result 1 and result 2
Regards,
Sai