Forum Discussion
Row Difference BY Period
- 2 years ago
Hi,
Assuming you have a Calendar Table with a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table AND to your visual, you have dragged Month and Year from the Calendar Table, write these measures:
Previous month budget = calculate([Budget],previousmonth(Calendar[date]))
Diff = [Budget]-[Previous month budget]
Hope this helps.
- Anonymous2 years ago
Hi Sime
If your source data table is like the sample data provided, you can create a calculated column with below DAX:
Difference = var curMonth = 'Table'[Period] var preBudget = CALCULATE(SUM('Table'[Budget]),ALL('Table'),'Table'[Period]=EOMONTH(curMonth,-1)) return 'Table'[Budget] - preBudgetBest Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
Hi,
Based on the table that you have shared, show the expected result very clearly.
Hi Ashish, I have added the expected "Difference" values to the sample table data below and to the original thread:
| Period | Previous % | Overall % | Budget | Difference |
| 30/09/2023 | 0 | 0 | 0 | 0 |
| 31/10/2023 | 0 | 20 | 401,932.00 | 401,932.00 |
| 30/11/2023 | 20 | 52 | 669,156.00 | 267,224.00 |
| 31/12/2023 | 52 | 74 | 669,156.00 | 0 |
Any help would be appreciated. Thank you.
- Ashish_Mathur2 years agoSuper User
Hi,
Assuming you have a Calendar Table with a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table AND to your visual, you have dragged Month and Year from the Calendar Table, write these measures:
Previous month budget = calculate([Budget],previousmonth(Calendar[date]))
Diff = [Budget]-[Previous month budget]
Hope this helps.