Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Above Function Problem

Hi,

I use Above Function because I need to do difference between row 1 vs row 2, row 2 vs row 3 etc.

I have this situation:

    

Item CodeDataStockData2Days
B00000512011-08-0536--
B00000512011-08-20302011-08-0515
B00000512011-08-24182011-08-204
B00000512011-09-02362011-08-249
B00000512011-09-16302011-09-0214
B00000512011-09-24242011-09-168
B00000512011-09-30182011-09-246
B00000512011-10-09122011-09-309
B00000512011-10-14362011-10-095
B00000512011-11-06302011-10-1423
B00000512011-11-22302011-11-0616
B00000512011-12-17182011-11-2225
B00000512011-12-27122011-12-1710
B00000512012-02-09182011-12-2744
B00000512012-05-18122012-02-0999
B00000519999-12-3102012-05-180

I need to have in the first row this scenario:

B00000512011-08-052011-08-2015

Etc.

How can I do?

Thanks

1 Solution

Accepted Solutions
marcus_sommer

It seems that you need the inversion from above() the function below().

- Marcus

View solution in original post

4 Replies
marcus_sommer

It seems that you need the inversion from above() the function below().

- Marcus

Ralf-Narfeldt
Employee
Employee

If you have that table loaded, let's say it's called Table1, you can just add:

Table2:

LOAD [Item Code], Data2, Data, Days Resident Table1 Where Not IsNull(Days);

Drop table Table1;

tresesco
MVP
MVP

May be like:

RangeSum(-Data,Below(Data2))

MK_QSL
MVP
MVP

Temp:

Load

  [Item Code],

  Date(Date#(Data,'YYYY-MM-DD')) as Data,

  Stock

Inline

[

  Item Code, Data, Stock

  B0000051, 2011-08-05, 36

  B0000051, 2011-08-20, 30

  B0000051, 2011-08-24, 18

  B0000051, 2011-09-02, 36

  B0000051, 2011-09-16, 30

  B0000051, 2011-09-24, 24

  B0000051, 2011-09-30, 18

  B0000051, 2011-10-09, 12

  B0000051, 2011-10-14, 36

  B0000051, 2011-11-06, 30

  B0000051, 2011-11-22, 30

  B0000051, 2011-12-17, 18

  B0000051, 2011-12-27, 12

  B0000051, 2012-02-09, 18

  B0000051, 2012-05-18, 12

  B0000051, 9999-12-31, 0

];

Final:

Load

  [Item Code],

  Data,

  Date(Previous(Data)) as PreviousData,

  Interval(Data - Previous(Data),'DD') as Days,

  Stock

Resident Temp

Order By [Item Code], Data;

Drop Table Temp;