Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Previous Row Value in Script

Dear all,

     kindly below my input and require output

Table Input

LocationItemLineIDDaysReqAvailable
XXXABCLine146132
XXXABCLine240132
YYYABCLine35516
YYYABCLine44316
YYYABCLine54016
YYYABCLine63416
YYYABCLine72316
YYYABCLine8516
YYYABCLine9316

Output shoul be like than:

LocationItemLineIDDaysReqAvailableoutput
XXXABCLine14613231
XXXABCLine24013230
YYYABCLine355165
YYYABCLine443164
YYYABCLine540163
YYYABCLine634162
YYYABCLine723161
YYYABCLine85160
YYYABCLine9316-1
Tags (1)
2 Replies
giakoum
Honored Contributor II

Re: Previous Row Value in Script

How is output calculated? Please share some insight, we cannot read minds I am afraid...

marcus_malinow
Valued Contributor III

Re: Previous Row Value in Script

Maybe this...

LOAD

Location,

Item,

LineID,

Days,

Req,

Available,

if (isnull(peek('Location', -1)) or peek('Location', -1) <> Location or peek('Item', -1) <> Item,

    Available - Req,

    peek('output', -1) - Req) as output

RESIDENT [Your Table]

Order by Location, Item, LineID

Community Browser