Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Adding a new column value with in a for loop

Hi All,

I'm new to Qlikview and struggling with a task. As you can see the below code, I want to calculate the percentile and add that value into the table Temp. When I use the load statement inside the for loop, it only shows the last row's percentile value for all the rows as shown in the image below.

FOR a=-1 to -1 //looping through unitMax

SET vUnitMax = Peek('maxunit',$(a),'unitMax'); //done

SET vMax = Peek('MaxForUnit',$(a),'unitMax'); //done

FOR i=-1 to $(rowText)-1 // looping through temp

SET vUnit = Peek('UNIT',$(i),'Temp');

SET vAttendance = Peek('ATTENDANCE',$(i),'Temp'); //read the Attendance from Temp

SET vPercentile = ($(vAttendance)/$(vMax))*100;

    SET vPercentile = ROUND($(vPercentile));

Left Join

LOAD $(vPercentile) AS Test Resident Temp;

NEXT i;

Capture.PNG

0 Replies