Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
2 Replies
giakoum
Partner - Master II
Partner - Master II

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

marcus_malinow
Partner - Specialist III
Partner - Specialist III

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