<?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 Re: FOR Each FieldValueList Fractile in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212035#M873098</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Mikhail -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe you are running into the same issue which we might have discussed previously also. I think after your first left join the new fields (Outlier_25, Outlier_15, &amp;amp; Outlier_5) are now available in the Stats table and when you do the second join, the values of these won't match and hence won't be joined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of joining them within the loop, collect these values in a temp table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;TempTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; LOAD UniqueKey,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Rebate &amp;gt;= $(v25th) and Rebate &amp;lt;= $(v75th), 'Not Outlier', 'Outlier') as Outlier_25,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Rebate &amp;gt;= $(v15th) and Rebate &amp;lt;= $(v85th), 'Not Outlier', 'Outlier') as Outlier_15,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Rebate &amp;gt;= $(v5th) and Rebate &amp;lt;= $(v95th), 'Not Outlier', 'Outlier') as Outlier_5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Resident Stats&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Where Country = '$(vCountry)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and after the loop is over, do a left join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join (Stats)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident TempTable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table TempTable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attaching your sample back&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Nov 2016 14:57:01 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2016-11-08T14:57:01Z</dc:date>
    <item>
      <title>FOR Each FieldValueList Fractile</title>
      <link>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212033#M873096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been hitting a wall with a simple FOR Each loop. I'm running out of ideas what could be the issue so I'm turning to you in for help. I would like to get a Fractile values for a specific field aggregated by Country. The idea is that, some of the rebates may be outliers and I'd like to provide a user ability to exclude outliers if they choose to.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is a sample app I made. In the script I:&lt;/P&gt;&lt;P&gt;- Load Unique Key, Country, and Rebate fields&lt;/P&gt;&lt;P&gt;- Find rebate fractiles for each country&lt;/P&gt;&lt;P&gt;- Store fractile values in variables&lt;/P&gt;&lt;P&gt;- Evaluate each rebate value to see if they are within our outside of frictile boundaries&lt;/P&gt;&lt;P&gt;- Add the results back to Stats table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For reason beyond me, the script as it is works marvelously for the first country, but fails for the rest of the countries. Does anyone know what I'm missing here? Is there a better way to do For Each loop in this scenario?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mikhail Bespartochnyy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212033#M873096</guid>
      <dc:creator>mbespartochnyy</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: FOR Each FieldValueList Fractile</title>
      <link>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212034#M873097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found a solution to my own problem. I still have no idea as to what's going on with FieldValueList() function or why it's working only for the first value in the list, but I was able to use a simple Group By function to solve the problem. The group by is much simpler and more intuitive and does the same thing in this case. I figured I'd share it in case someone else is having the same issue. Attached is revised app containing original and final scripts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;P.S. If you can shed some light on where I went wrong with FieldValueList() function, please do, I'm still very curious why it didn't work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2016 14:39:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212034#M873097</guid>
      <dc:creator>mbespartochnyy</dc:creator>
      <dc:date>2016-11-08T14:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: FOR Each FieldValueList Fractile</title>
      <link>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212035#M873098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Mikhail -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe you are running into the same issue which we might have discussed previously also. I think after your first left join the new fields (Outlier_25, Outlier_15, &amp;amp; Outlier_5) are now available in the Stats table and when you do the second join, the values of these won't match and hence won't be joined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of joining them within the loop, collect these values in a temp table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff0000;"&gt;TempTable:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; LOAD UniqueKey,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Rebate &amp;gt;= $(v25th) and Rebate &amp;lt;= $(v75th), 'Not Outlier', 'Outlier') as Outlier_25,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Rebate &amp;gt;= $(v15th) and Rebate &amp;lt;= $(v85th), 'Not Outlier', 'Outlier') as Outlier_15,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; If(Rebate &amp;gt;= $(v5th) and Rebate &amp;lt;= $(v95th), 'Not Outlier', 'Outlier') as Outlier_5&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Resident Stats&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Where Country = '$(vCountry)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and after the loop is over, do a left join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Left Join (Stats)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD *&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Resident TempTable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DROP Table TempTable;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attaching your sample back&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2016 14:57:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212035#M873098</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-11-08T14:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: FOR Each FieldValueList Fractile</title>
      <link>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212036#M873099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like I pointed out, I don't think the issue is with FieldValueList() function. The issue is the order of your execution of Join. See if the below script makes sense &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE: Although I think Group By might be a good way to go about this as well &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2016 14:58:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212036#M873099</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-11-08T14:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: FOR Each FieldValueList Fractile</title>
      <link>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212037#M873100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Sunny - there is no issue with the fieldvaluelist-function. If you looked on the script-log or the execution-window you will see that the loop runs through all fieldvalues - but there are some issues with the logic and the syntax, for example the not supported DISTINCT within the fractile-function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2016 15:14:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/FOR-Each-FieldValueList-Fractile/m-p/1212037#M873100</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2016-11-08T15:14:03Z</dc:date>
    </item>
  </channel>
</rss>

