<?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: Using Fractile Function in IF Statement in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9284#M706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your expression seems to be correct, if you have Users in dimension&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is that you have ? what are dimension and expression exactly ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 May 2018 07:50:26 GMT</pubDate>
    <dc:creator>ogautier62</dc:creator>
    <dc:date>2018-05-25T07:50:26Z</dc:date>
    <item>
      <title>Using Fractile Function in IF Statement</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9283#M705</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write a set analysis expression that compares an individual user's &lt;STRONG&gt;avg(duration) &lt;/STRONG&gt;the 1st,2nd,3rd, etc quartiles and assigns a value based on the comparison. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the avg(duration) &amp;lt; 1st quartile the score would be 1&lt;/P&gt;&lt;P&gt;avg(duration) &amp;gt; 1st quartile and &amp;lt;2nd quartile would be 2 and etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have calculated the quartiles for the overall data set using &lt;STRONG&gt;fractile(duration, .25) as 1st quartile&lt;/STRONG&gt;, etc. &lt;SPAN style="font-size: 10pt;"&gt;So far the if statement I have written looks like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF( avg(duration) &amp;lt; fractile(TOTAL duration,.25),1,4)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Individual user values that are less than the 1st quartile of the total set still populate as 4, which suggests that the set analysis is comparing the avg of the entire dataset to the 1st quartile of the entire data set. I have also tried to wrap the avg in &lt;STRONG&gt;aggr&lt;/STRONG&gt; by the User dimension but still cannot get it to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone successfully implemented a similar set analysis expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2018 22:04:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9283#M705</guid>
      <dc:creator>andrewroda</dc:creator>
      <dc:date>2018-05-24T22:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using Fractile Function in IF Statement</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9284#M706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your expression seems to be correct, if you have Users in dimension&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is that you have ? what are dimension and expression exactly ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2018 07:50:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9284#M706</guid>
      <dc:creator>ogautier62</dc:creator>
      <dc:date>2018-05-25T07:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using Fractile Function in IF Statement</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9285#M707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would you be able to share few rows of sample data and explain what exactly are you looking to get as an output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2018 11:45:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9285#M707</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2018-05-25T11:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using Fractile Function in IF Statement</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9286#M708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oliver is right, the expression is correct for assigning the value if User is a dimension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you're describing though is not a behavior of set analysis. That is just a "filter" at the expression level and wouldn't assign any values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Aggr function is what you would need here. You need to match your Aggr dimensions to the external ones on your table. Try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum(Aggr(IF( avg(duration) &amp;lt; fractile(TOTAL duration,.25),1,4),User,Department))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;This expression would first calculate the "rating" and the user + department level. Then if the chart it's used in only has Department as a dimension then it would sum the "rating" for users in that department. The most common mistake with Aggr (aside from using it when it's not needed) is forgetting that it's virtual table that gets passed to attach to the dimensions on the chart object. The virtual table is not attached to the rest of the data in your app. In this example if Department wasn't included in the Aggr portion there would be no way to accurately assign users to the dimension in the chart.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2018 17:44:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9286#M708</guid>
      <dc:creator>bme</dc:creator>
      <dc:date>2018-05-25T17:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using Fractile Function in IF Statement</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9287#M709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Ben.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far your addition to my expression works with what I am trying to do. My next step is trying to use this expression to assign values to the other tiers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, I would like to have a system that assigns 1 to the the &lt;STRONG&gt;avg(duration) &amp;lt; .fractile(duration,.25)&lt;/STRONG&gt; and then 2 to the &lt;STRONG&gt;avg(duration) between fractile(duration, .25) and fractile(duration, .50)&lt;/STRONG&gt; and then follow the same pattern assigning 3 and 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not too familiar with Aggr and am not having much luck expanding this expression to include multiple ratings. Do you have any suggestions for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am going to keep playing around with the expression but so far I have tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum(Aggr(IF( avg(CallDurationSeconds) &amp;lt; fractile(TOTAL CallDurationSeconds,.25),1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IF( avg(CallDurationSeconds) &amp;gt;= fractile(TOTAL CallDurationSeconds,.25) and avg(CallDurationSeconds) &amp;lt; fractile(TOTAL CallDurationSeconds,.50),2),&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4),%UserID,SalesTeamID))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 May 2018 13:47:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9287#M709</guid>
      <dc:creator>andrewroda</dc:creator>
      <dc:date>2018-05-29T13:47:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using Fractile Function in IF Statement</title>
      <link>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9288#M710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew&lt;/P&gt;&lt;P&gt;I have used this to get the average of each quartile which is using the fractile as a filter in the set expression. Not sure if that will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=avg({&amp;lt;MyRow={"&amp;lt;=$(=fractile(total MyRow,.25))"}&amp;gt;}MyRow)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There seems to be a bug that it ignores current selections of the field you're averaging, but I got around it by forcing the top value when averaging the other quartiles:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=avg({&amp;lt;MyRow={"&amp;gt;=$(=fractile(total R,.5))&amp;lt;$(=fractile(total MyRow,.75))"}&amp;gt;}MyRow)&amp;nbsp; &lt;/P&gt;&lt;P&gt;=avg({&amp;lt;MyRow={"&amp;gt;=$(=fractile(total MyRow,.75))&amp;lt;=$(=max(total MyRow))"}&amp;gt;}MyRow)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have included the app and shown where it goes wrong.&lt;/P&gt;&lt;P&gt;!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jul 2018 11:12:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Using-Fractile-Function-in-IF-Statement/m-p/9288#M710</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-18T11:12:50Z</dc:date>
    </item>
  </channel>
</rss>

