Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
david_ze
Partner - Contributor III
Partner - Contributor III

Script assistance

Hi All,
I'll appreciate your assistance on the issue I have as described below:


Contains the first 4 columns - I would like to add a new filed (Potential_Left) with the calculated data  as shown below

WarehouseProduct_PotentialWorkOrderProductionPotential_Left
A5001150350
A5002100

250

A500350200
A50042000

I'll appreciate your advise.

Thanks
David

4 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Load

          Warehouse,

          Product_Potential,

          WorkOrder,

          Production,

          Product_Potential - NumSum(Previous(Potential_Left), Production) AS Potential_Left

     FROM ...

Celambarasan

swuehl
MVP
MVP

David,

I think it could look like

LOAD

...

if(isnull(peek(Potential_Left)),Product_Potential,peek(Potential_Left))-Production as Potential_Left,

...

from Table;

maybe including a check for Warehouse in the if() statement and using an appropriate order of your records.

Regards,

Stefan

david_ze
Partner - Contributor III
Partner - Contributor III
Author

Hi Stefan,
can you attach the scripting you think should matxh here?
I also want to care the case we have an additional warehouse (B, C etc).
Thanks,
David

swuehl
MVP
MVP

I think it could look like (if your table existing table is labelled TMP):

RESULT:

LOAD Warehouse, Product_Potential, WorkOrder, Production,

if(peek(Warehouse)=Warehouse,peek(Potential_Left), Product_Potential) - Production as Potential_Left

resident TMP order by Warehouse, WorkOrder;

drop table TMP;