Forum Discussion
DAX considering previous rows result in next rows but same column
Hey askpbiuser ,
I can not see a difference between Wrong and calcRight.
Nevertheless, you have to be aware of the fact that there is no implicit order of rows inside a table. This means that you have to use DAX windowing functions in combination with the partitionBy switch. Here you will find an introduction to WINDOW: WINDOW function (DAX) - DAX | Microsoft Learn
Hopefully, this helps to tackle your challenge.
Regards,
Tom
Thanks Tom.
The difference between Wrong cal and Right calc formula is -
Wrong calc - MIN(Demand,Sales)
Right calc - MIN(Demand,Sales) for first row and then
MIN(Demand - (Sum of previous (Right calc result),Sales)
To note here is the MIN formula which keeps changing and takes cumulative total into consideration.
Please let me know if more information needed.
I still had no luck in getting the right ans.