Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
markgraham123
Specialist
Specialist

Peek and create flag

Hello,

Here is my original data set in the application.

REQ field is just repeating.

Any help ism highly appreciated.

     

ITEMLocationAvailableAvailableDateREQCan fill
1Dallas20410/24/2017104104
1Dallas30011/5/2017104
1Dallas6011/15/2017104
1Dallas20412/1/2017104
1Dallas20412/2/2017104
2Chicago3510/21/201722
2Chicago4012/1/20172
2Chicago4412/1/20172
2NY3812/5/20173
2NY4312/5/20173
3Chicago30010/21/2017250250
3Chicago012/1/20172
3Chicago012/1/20172
3NY312/5/20174003
3NY1012/5/2017

3

21 Replies
markgraham123
Specialist
Specialist
Author

stalwar1

Can you please give a look?

sujith1011
Partner - Creator
Partner - Creator

Mark,

Try this

ITEMTEMP:

LOAD
    ITEM,
    Location,
    Available,
    AvailableDate,
    REQ
FROM [lib://DataDiscoverySharedFolder/New folder\sample.xlsx]
(ooxml, embedded labels, table is Sheet2)
;

NoConcatenate
ITEM:
LOAD
ITEM,
    Location,
    Available,
    AvailableDate,
    REQ,
    if(isnull(CANFILL),0,CANFILL)+ if(IsNull(Pavail),0, if(ITEM&Location= previtemdate,Pavail,0)) as CANFILL ,

    BALANCE ;

Load *,
IF(REQ>Available,Available,REQ) AS CANFILL,
IF(REQ>=Available,REQ-Available) AS BALANCE,
PEEK('ITEM')&peek('Location')  as previtemdate,
peek('BALANCE') as Pavail
Resident ITEMTEMP ORDER BY ITEM, Location,AvailableDate ;
DROP TABLE ITEMTEMP;