<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Adding a new column value with in a for loop in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Adding-a-new-column-value-with-in-a-for-loop/m-p/139438#M600878</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR a=-1 to -1 //looping through unitMax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vUnitMax = Peek('maxunit',$(a),'unitMax'); //done&lt;/P&gt;&lt;P&gt;SET vMax = Peek('MaxForUnit',$(a),'unitMax'); //done&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=-1 to $(rowText)-1 // looping through temp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vUnit = Peek('UNIT',$(i),'Temp');&lt;/P&gt;&lt;P&gt;SET vAttendance = Peek('ATTENDANCE',$(i),'Temp'); //read the Attendance from Temp&lt;/P&gt;&lt;P&gt;SET vPercentile = ($(vAttendance)/$(vMax))*100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET vPercentile = ROUND($(vPercentile));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left Join&lt;/P&gt;&lt;P&gt;LOAD $(vPercentile) AS Test Resident Temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT i;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/216825_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Oct 2018 04:00:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-10-26T04:00:20Z</dc:date>
    <item>
      <title>Adding a new column value with in a for loop</title>
      <link>https://community.qlik.com/t5/QlikView/Adding-a-new-column-value-with-in-a-for-loop/m-p/139438#M600878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR a=-1 to -1 //looping through unitMax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vUnitMax = Peek('maxunit',$(a),'unitMax'); //done&lt;/P&gt;&lt;P&gt;SET vMax = Peek('MaxForUnit',$(a),'unitMax'); //done&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR i=-1 to $(rowText)-1 // looping through temp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vUnit = Peek('UNIT',$(i),'Temp');&lt;/P&gt;&lt;P&gt;SET vAttendance = Peek('ATTENDANCE',$(i),'Temp'); //read the Attendance from Temp&lt;/P&gt;&lt;P&gt;SET vPercentile = ($(vAttendance)/$(vMax))*100;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET vPercentile = ROUND($(vPercentile));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Left Join&lt;/P&gt;&lt;P&gt;LOAD $(vPercentile) AS Test Resident Temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NEXT i;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/216825_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Oct 2018 04:00:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Adding-a-new-column-value-with-in-a-for-loop/m-p/139438#M600878</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-26T04:00:20Z</dc:date>
    </item>
  </channel>
</rss>

