Forum Discussion
kbabu57
2 years agoRegular Visitor
Cumulative Sum by 2 columns
Hi Folks and Fowmy Jihwan_Kim I have a requirement where i have to get cumulative sum by 2 columns. The below is the sample data The thing is Final Amount is coming by Customer Number and Year ...
- 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.
Ashish_Mathur
Super User
2 years agoYou are welcome. You must create a Calendar Table.
kbabu57
2 years agoRegular Visitor
Hi Ashish Ashish_Mathur
Thank you. Much appreciated for your help. However, i just tried without creating extra Calendar table, with the existing data that has date column, got the required output as well 🙂