Forum Discussion

William_Moreno's avatar
5 years ago

Balance Inventory table

Hi everyone,
I need help with this table below, I want to reproduce this in data columns and only with dax formulas, I can't use powerquery in this case. 

LocalPartNumberDateDemandOrdersTransferStrategy InvetoryOpenStockNeededRevised NeedCloseStock
Italy30397201/03/202108.00009.4200-1.4201.4209.420
Italy30397201/04/202110.4818.00009.4209.420-2.4812.4819.420
Italy30397201/05/202111.12612.00009.4209.4200010.294
Italy30397201/06/202111.490009.42010.294-10.61610.6169.420
Italy30397201/07/202111.445009.4209.420-11.44511.4459.420
Italy30397201/08/202111.704009.4209.420-11.70411.7049.420
Italy30397201/09/202111.970009.4209.420-11.97011.9709.420
Italy30397201/10/202112.126009.4209.420-12.12612.1269.420
Italy30397201/11/202111.281009.4209.420-11.28111.2819.420
Italy30397201/12/202111.381009.4209.420-11.38111.3819.420

 

The red collors are formulas like theses:

OpenStock = CloseStock month before

Needed = IF(OpenStock + Orders – Demand-Transfer>Strategy,0,OpenStock + Orders – Demand-Transfer-Strategy)

Revised Need = Needed x (-1)
CloseStock = OpenStock + Orders – Demand-Transfer +Needed

 

I will be very grateful if anyone can help me

thanks in advanced

1 Reply

  • Icey's avatar
    Icey
    Community Support

    Hi William_Moreno ,

     

    I'm afraid this is unachievable with DAX.

    This row's value of Measure/Column 1 is based on previous row's value of Measure/Column 2, and This row's value of Measure/Column 2 is based on previous row's value of Measure/Column 2. This kind of calculation logic cannot be implemented with DAX.

     

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.