Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Channa
Specialist III
Specialist III

Loop for each entity

Hi Experts

i need some help with writing different kind of loop

for first record of every entity it has to calculate Transaction Amount + Initial amount   into new column as EOP

from second record it has to be sum(first record in EOP) + 2nd record in initial Amount

i am attaching xls

i am trying to generate EOP column using Qlik Script not in report level

 

Channa
Labels (1)
1 Reply
justISO
Specialist
Specialist

Hi, try this:

temp:
LOAD
    SubBank,
    YearMonth,
    [Transaction Amount],
    Initial_Amount,
    if(SubBank<>Previous(SubBank) or RowNo()=1, [Transaction Amount]+Initial_Amount, Initial_Amount) as sumTrIn,
    EOP
FROM [lib://AttachedFiles/Help.xlsx](ooxml, embedded labels, table is Sheet1);

NoConcatenate
main:
LOAD
    SubBank,
    YearMonth,
    [Transaction Amount],
    Initial_Amount,
    if(SubBank=Previous(SubBank), rangesum(sumTrIn ,peek('EOP')), sumTrIn) as EOP
RESIDENT temp;

DROP TABLE temp;