I use a formula in my excel workbook that references the previous cell or cell above in order to calculate inventory based on order count. I have searched far and wide for a way to do this in Power Query in a custom column and have had no luck. Can anyone assist? I would like this in a custom column in Power Query. I need this a custom column formula (the formula one would enter in the custom column box, not in the advanced editor).
It subtracts the order quantity from the available inventory based on the order quantity of the line above it. The formula I use in excel is:
=IF(B2-B1,E1-C2,D2-C2) Why does Power Query make these simple formulas so difficult?
[TABLE="width: 465"]
<colgroup><col span="4"><col></colgroup><tbody>[TR]
[TD]Order[/TD]
[TD]Material[/TD]
[TD]Order QTY[/TD]
[TD]Inventory[/TD]
[TD]Available Inventory[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]123456[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]1234567[/TD]
[TD]12121212[/TD]
[TD]4[/TD]
[TD]7[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]23456[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]234567[/TD]
[TD]12121212[/TD]
[TD]2[/TD]
[TD]7[/TD]
[TD]-2[/TD]
[/TR]
[TR]
[TD]2345678[/TD]
[TD]12121212[/TD]
[TD]4[/TD]
[TD]7[/TD]
[TD]-6[/TD]
[/TR]
[TR]
[TD]465546546[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]-7[/TD]
[/TR]
[TR]
[TD]23525663[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]-8[/TD]
[/TR]
[TR]
[TD]96878768[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]-9[/TD]
[/TR]
[TR]
[TD]12345678[/TD]
[TD]12341234[/TD]
[TD]2[/TD]
[TD]8[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]123456789[/TD]
[TD]12341234[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]234567989[/TD]
[TD]12341234[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]464646456[/TD]
[TD]12341234[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]-5[/TD]
[/TR]
[TR]
[TD]546456464[/TD]
[TD]12341234[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]-6[/TD]
[/TR]
[TR]
[TD]856745474[/TD]
[TD]12341234[/TD]
[TD]2[/TD]
[TD]8[/TD]
[TD]-8[/TD]
[/TR]
</tbody>[/TABLE]
It subtracts the order quantity from the available inventory based on the order quantity of the line above it. The formula I use in excel is:
=IF(B2-B1,E1-C2,D2-C2) Why does Power Query make these simple formulas so difficult?
[TABLE="width: 465"]
<colgroup><col span="4"><col></colgroup><tbody>[TR]
[TD]Order[/TD]
[TD]Material[/TD]
[TD]Order QTY[/TD]
[TD]Inventory[/TD]
[TD]Available Inventory[/TD]
[/TR]
[TR]
[TD]12345[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]123456[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]1234567[/TD]
[TD]12121212[/TD]
[TD]4[/TD]
[TD]7[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]23456[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]234567[/TD]
[TD]12121212[/TD]
[TD]2[/TD]
[TD]7[/TD]
[TD]-2[/TD]
[/TR]
[TR]
[TD]2345678[/TD]
[TD]12121212[/TD]
[TD]4[/TD]
[TD]7[/TD]
[TD]-6[/TD]
[/TR]
[TR]
[TD]465546546[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]-7[/TD]
[/TR]
[TR]
[TD]23525663[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]-8[/TD]
[/TR]
[TR]
[TD]96878768[/TD]
[TD]12121212[/TD]
[TD]1[/TD]
[TD]7[/TD]
[TD]-9[/TD]
[/TR]
[TR]
[TD]12345678[/TD]
[TD]12341234[/TD]
[TD]2[/TD]
[TD]8[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]123456789[/TD]
[TD]12341234[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]234567989[/TD]
[TD]12341234[/TD]
[TD]3[/TD]
[TD]8[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]464646456[/TD]
[TD]12341234[/TD]
[TD]5[/TD]
[TD]8[/TD]
[TD]-5[/TD]
[/TR]
[TR]
[TD]546456464[/TD]
[TD]12341234[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]-6[/TD]
[/TR]
[TR]
[TD]856745474[/TD]
[TD]12341234[/TD]
[TD]2[/TD]
[TD]8[/TD]
[TD]-8[/TD]
[/TR]
</tbody>[/TABLE]