Forum Discussion
Using a cumulative column to create a month-wise column
Data:
This table has cumulative values for each 'Code' shown monthwise. Code and Month are unique in the data.
Code BALANCE_DATE Cumulative
| 1001 | January-19 | 6849.31 |
| 1001 | February-19 | 6849.31 |
| 1001 | March-19 | 20821.91 |
| 1001 | April-19 | 37260.27 |
| 1001 | May-19 | 37260.27 |
| 1001 | June-19 | 37260.27 |
| 1002 | February-19 | 31.05 |
| 1002 | March-19 | 31.05 |
| 1002 | April-19 | 31.05 |
| 1002 | May-19 | 310.44 |
| 1002 | June-19 | 310.44 |
| 1002 | July-19 | 310.44 |
| 1002 | August-19 | 465.66 |
| 1002 | September-19 | 465.66 |
Required:
I want a column that would show the amount generated each month (current month - previous month). What is the DAX for this?
Thank you.
- Anonymous6 years ago
Hi danialsj ,
Please try using EARLIER() function.
Column = 'Table'[Cumulative] - CALCULATE ( MAX ( 'Table'[Cumulative] ), FILTER ( 'Table', 'Table'[Code] = EARLIER ( 'Table'[Code] ) ), PREVIOUSMONTH ( 'Table'[BALANCE_DATE] ) )Result would be shown as below.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- az38
Community Champion
- danialsjFrequent Visitor
Is there a way to make it a custom column?
- AnonymousNot applicable
Hi danialsj ,
Please try using EARLIER() function.
Column = 'Table'[Cumulative] - CALCULATE ( MAX ( 'Table'[Cumulative] ), FILTER ( 'Table', 'Table'[Code] = EARLIER ( 'Table'[Code] ) ), PREVIOUSMONTH ( 'Table'[BALANCE_DATE] ) )Result would be shown as below.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.