Forum Discussion
Cumulative Sum by 2 columns
- Anonymous2 years ago
Hi kbabu57
Ashish_Mathur Good share!
For your question, here is the method I provided:
Here's some dummy data
"Datas"
You can create a measure. Group by customer number, and add up "Diff" and "Balance Pay".
Final Amount = CALCULATE ( SUM ('Datas'[Price Amt]), FILTER ( ALLEXCEPT ('Datas', 'Datas'[Customer Number]), 'Datas'[Year] = MAX ('Datas'[Year]) ) ) + CALCULATE ( SUM ('Datas'[Diff]), FILTER ( ALLEXCEPT ('Datas', 'Datas'[Customer Number]), 'Datas'[Year] <= MAX ('Datas'[Year]) ) ) - CALCULATE ( SUM ('Datas'[Balance Pay]), FILTER ( ALLEXCEPT ('Datas', 'Datas'[Customer Number]), 'Datas'[Year] <= MAX ('Datas'[Year]) ) )Here is the result
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi kbabu57
Ashish_Mathur Good share!
For your question, here is the method I provided:
Here's some dummy data
"Datas"
You can create a measure. Group by customer number, and add up "Diff" and "Balance Pay".
Final Amount =
CALCULATE (
SUM ('Datas'[Price Amt]),
FILTER (
ALLEXCEPT ('Datas', 'Datas'[Customer Number]),
'Datas'[Year] = MAX ('Datas'[Year])
)
)
+ CALCULATE (
SUM ('Datas'[Diff]),
FILTER (
ALLEXCEPT ('Datas', 'Datas'[Customer Number]),
'Datas'[Year] <= MAX ('Datas'[Year])
)
)
- CALCULATE (
SUM ('Datas'[Balance Pay]),
FILTER (
ALLEXCEPT ('Datas', 'Datas'[Customer Number]),
'Datas'[Year] <= MAX ('Datas'[Year])
)
)
Here is the result
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Wow.. This is even better. Thank you Nono Chen