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 Ashish Ashish_Mathur
1st of all , Thank you so much for replying my thread. Sorry for delayed reply as i am trying out with any options & combinations with the above pbi file which you attached. Seems like, you created a extra table called "Date" and developed the logics to achieve the requirement. Is there any way without creating extra "date" and build the logic with the existing data ?
I will take a step back. I have only customer numbers as below and want to achieve the requirement.Please provide your thoughts how can we get with the below data
Customer Number | Price Amt | Diff | Balance Pay | Final Amount |
| abc123 | $1000 | -50 | $500 | $450 |
| abc123 | $1000 | 100 | $600 | -$50 |
| abc123 | $1000 | 200 | $200 | -$50 |
| def567 | $2000 | 800 | $100 | $2700 |
| def567 | $2000 | 700 | $300 | $3100 |
| def567 | $2000 | 600 | $400 | $3700 |
Thanks in advance
- Ashish_Mathur2 years ago
Super User
You are welcome. You must create a Calendar Table.
- kbabu572 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 🙂