Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
vinayak_rastogi_terex
Contributor
Contributor

Calculate the Forecast QOH based on Current Month Inventory QOH(Quantity On Hand)/future Demand Units/ future Production Units

Hello Everyone, 

I really looking forward for your help and support, in Qlik Script side

Future QOH Formula for Calculation - (Current Month Inventory QOH (Jan-2024)  + Production Units (Feb-2024) ) - Demand Units (Feb-2024)

vinayak_rastogi_terex_0-1705896585086.png

Likewise same for other months future months,  Based calculated Future QOH for next Month March 2024

I've try that in Qlik Script -

T2:
Load
    %Key,
    Date(CalMonth, 'MMM-YYYY') as CalMonthDate,
    Prod,
    Geo,
    model,
    Mfg_location,
    SUM(quantity_on_hand) as SUMQty,
    SUM(Demand_Units) as Demand_UT,
    SUM(Production_Units) as Production_UT
 
Resident Table1 
Group by %Key, Geo, Prod, model, Mfg_location, CalMonth
Order By model, Geo, Prod, Mfg_location, CalMonth asc;
 
 
NoConcatenate
FutureQOHTemp:
Load
    RowNo() as ID,
    %Key,
    CalMonthDate,
    Prod,
    Geo,
    model,
    Mfg_location,
    SUMQty,
    Demand_UT,
    Production_UT,
     IF(model <> Previous(model) ,SUMQty,(Peek(StockNew)+Production_UT)-Demand_UT)  as StockNew
 
Resident T2
Order By Geo, Prod, model, Mfg_location, CalMonthDate asc;

 

Output based on above scriptRed Circle Output showcasing wrongly, other side showcasing the output for "King County" is correct (Highlighted in Yellow) 

vinayak_rastogi_terex_0-1705898685251.png

 

Thank you!

Labels (2)
0 Replies