<?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 aggr with if statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861970#M301675</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This does appear to be working on the small data set that I have created thank you,but can you please explain the use of the extra distinct and nondistinct so that I can better understand what you did and why you did it?&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Apr 2015 20:38:13 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-04-30T20:38:13Z</dc:date>
    <item>
      <title>Using aggr with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861965#M301670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have&amp;nbsp; expressions that are aggr expressions. If i use them individually they give the correct values but if i use an if statement they do not give values. For eg pls see attached qvw. I am trying to use a table with a dimension a and b. For a i want to show aggr(expr1) and for b i want to show aggr(expression2). Can aggr functions not be used with if statements ?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2015 20:19:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861965#M301670</guid>
      <dc:creator />
      <dc:date>2015-04-30T20:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861966#M301671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the expected output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2015 20:25:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861966#M301671</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-04-30T20:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861967#M301672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;F1| Expr&lt;/P&gt;&lt;P&gt;a&amp;nbsp; | 4.555&lt;/P&gt;&lt;P&gt;b&amp;nbsp; | 5&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2015 20:27:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861967#M301672</guid>
      <dc:creator />
      <dc:date>2015-04-30T20:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861968#M301673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Partially working:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i&lt;STRONG&gt;f(F1='a',sum((tenure*aggr(NODISTINCT count({&amp;lt;flag={1}&amp;gt;}distinct(accounts)),tenure)))/count({&amp;lt;flag={1}&amp;gt;}distinct(accounts))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;,if(F1='b',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum((tenure*aggr(NODISTINCT count({&amp;lt;flag={0}&amp;gt;}distinct(accounts)),tenure)))/count({&amp;lt;flag={0}&amp;gt;}distinct(accounts)),0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need to figure out why they are doubling. Maybe you can figure that out because of a better understanding of the data behind the scene.&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>Thu, 30 Apr 2015 20:29:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861968#M301673</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-04-30T20:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861969#M301674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here, this is working&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if(F1='a',sum(DISTINCT(tenure*aggr(NODISTINCT count({&amp;lt;flag={1}&amp;gt;}distinct(accounts)),tenure)))/count({&amp;lt;flag={1}&amp;gt;}distinct(accounts))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;,if(F1='b',&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sum(DISTINCT(tenure*aggr(NODISTINCT count({&amp;lt;flag={0}&amp;gt;}distinct(accounts)),tenure)))/count({&amp;lt;flag={0}&amp;gt;}distinct(accounts)),0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&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>Thu, 30 Apr 2015 20:31:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861969#M301674</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-04-30T20:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861970#M301675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This does appear to be working on the small data set that I have created thank you,but can you please explain the use of the extra distinct and nondistinct so that I can better understand what you did and why you did it?&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2015 20:38:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861970#M301675</guid>
      <dc:creator />
      <dc:date>2015-04-30T20:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using aggr with if statement</title>
      <link>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861971#M301676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Had to use Distinct after Sum because of your data model. F1 was a island table which was duplicating all the records when getting used in the same table. You can live without that if your original data is not duplicating. The NODISTINCT is telling the Aggr function to repeat the same value for all the value in your table. Otherwise by default Aggr uses Distinct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&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>Thu, 30 Apr 2015 20:43:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-aggr-with-if-statement/m-p/861971#M301676</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-04-30T20:43:15Z</dc:date>
    </item>
  </channel>
</rss>

