Forum Discussion
Log2Ins
4 years agoNew Member
Conditional expressions using DAX
Hi all,
I have a table of the following type:
| Month | Year | Qty 1 | Qty 2 |
| 1 | 2022 | 500000 | 100000 |
| 2 | 2022 | 400000 | 150000 |
I want a new column "Delta Qty 2" which is the difference between Qty 2 of the current month and Qty 2 of the previous month, same year. In the above example it shoul be: 150000 - 100000 = 50000
How can I do it with DAX?
Thanks.
Log2Ins , A new column
Delta Qty 2 =
var _sum = sumx(filter(Table, [Year] =earlier([Year]) && [Month] =earlier([Month]) -1) , [Qty 2])
return
[Qty 2] - _sum
2 Replies
- amitchandakSuper User
Log2Ins , A new column
Delta Qty 2 =
var _sum = sumx(filter(Table, [Year] =earlier([Year]) && [Month] =earlier([Month]) -1) , [Qty 2])
return
[Qty 2] - _sum
- Log2InsNew Member
Thank you very much!!