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: 
AbhijitBansode
Specialist
Specialist

Working with loaded data

Hi ,

I'm getting below table by performing some calculations on loaded data:

ProductNoTermTernAvg
120091stTerm10000
120092ndTerm2000
1201011stterm3000
120102ndTerm500
220091stTerm15000
220092ndTerm1300
2201011stterm1500
220102ndTerm1400


Now my requirement is to add one more column viz., Prev_termAvg to this table which will calculate the previous term average of the term for each product.

ProductNoTermTernAvgPrev_termAvg
120091stTerm100000
120092ndTerm20001000
1201011stterm30002000
120102ndTerm5003000
220091stTerm150000
220092ndTerm130015000
2201011stterm15001300
220102ndTerm14001500


Here , Prev_termAvg of 20091stTerm for ProductNo 1 is 0, because productNo 1 is starting from 20091stTerm , lly for ProductNo 2

Please let me know hoe to achieve this operation at QlikView script level.

1 Solution

Accepted Solutions
Not applicable

Hello cabhiji,

I loaded your raw data inline and tried this:

NoConcatenate
LOAD
*,
IF(ProductNo = Previous(ProductNo),
Previous(TernAvg),
0) AS Prev_termAvg
Resident RawData;


Regards, Roland

View solution in original post

1 Reply
Not applicable

Hello cabhiji,

I loaded your raw data inline and tried this:

NoConcatenate
LOAD
*,
IF(ProductNo = Previous(ProductNo),
Previous(TernAvg),
0) AS Prev_termAvg
Resident RawData;


Regards, Roland