<?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: Ignore the current selection within aggr() function in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/1288043#M403152</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You shouldn't need to use Aggr-function to achieve what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this expression instead:&lt;/P&gt;&lt;P&gt;Sum(&lt;STRONG&gt;DISTINCT&lt;/STRONG&gt; {&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;ClientName={"=Sum({&amp;lt;Date={'Sep-16'}&amp;gt;} Income)&amp;lt;=10"},Date={'Sep-16'}&amp;gt;} Cost)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(&lt;STRONG&gt;DISTINCT&lt;/STRONG&gt; {&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;ClientName={"=Sum({&amp;lt;Date={'Aug-16'}&amp;gt;} Income)&amp;lt;=10"},Date={'Aug-16'}&amp;gt;} Cost)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice the DISTINCT and the set identifier 1 (which denotes ALL and not only the currently selected).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jan 2017 22:38:58 GMT</pubDate>
    <dc:creator>petter</dc:creator>
    <dc:date>2017-01-06T22:38:58Z</dc:date>
    <item>
      <title>Ignore the current selection within aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/1288042#M403151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#575757&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;NaN&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;transparent&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;,&amp;quot;verticalAlign&amp;quot;:&amp;quot;baseline&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" style="width: 256px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="color: #ffffff; text-align: center; padding: 2px; background-color: #6690bc;"&gt;Date&lt;/TH&gt;&lt;TH style="color: #ffffff; text-align: center; padding: 2px; background-color: #6690bc;"&gt;ClientName&lt;/TH&gt;&lt;TH style="color: #ffffff; text-align: center; padding: 2px; background-color: #6690bc;"&gt;Income&lt;/TH&gt;&lt;TH style="color: #ffffff; text-align: center; padding: 2px; background-color: #6690bc;"&gt;Cost&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Sep-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;A&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;5&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Sep-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;B&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;7&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Sep-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;C&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;15&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Sep-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;D&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;9&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Sep-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;E&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;9&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Aug-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;A&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;6&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Aug-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;B&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;9&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Aug-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;C&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;8&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Aug-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;D&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;15&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl142" height="20" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;Aug-16&lt;/TD&gt;&lt;TD style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;F&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;8&lt;/TD&gt;&lt;TD align="right" style="color: #575757; text-align: left; font-family: arial, helvetica, sans-serif; vertical-align: middle; background-color: rgba(0, 0, 0, 0);"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Above is a made up flat table to illustrate my question. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I use QlikSense and my current selection is "Sep-16". &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;So, I want to divide my ClientName into 2 groups: Group that Income &amp;lt;=10 and Income &amp;gt;10. And I want to calculate the sum of all cost of each of these 2 groups for both Sep-16 and Aug-16. So I come up with something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Sep-16: sum({&amp;lt;ClientName={"=aggr(sum(&lt;SPAN style="font-size: 13.3333330154419px;"&gt;{&amp;lt;Date={'Sep-16'}&amp;gt;}&lt;/SPAN&gt;Income),ClientName)&amp;lt;=10"},&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Date={'Sep-16'}&amp;gt;}&lt;/SPAN&gt; Cost)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Aug-16: &lt;SPAN style="font-size: 13.3333330154419px;"&gt;sum({&amp;lt;ClientName={"=aggr(sum({&amp;lt;Date={'Aug-16'}&amp;gt;}Income),ClientName)&amp;lt;=10"},Date={'Aug-16'}&amp;gt;} Cost)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;SPAN style="text-decoration: underline;"&gt;formula works fine for Sep-16&lt;/SPAN&gt;. However, &lt;SPAN style="text-decoration: underline;"&gt;Aug-16 formula doesn't work&lt;/SPAN&gt;. What I think to be the problem, (95% sure about this), is that when Qlik create the aggr() data, it uses the ClientName exist within the current selection - "Sep-16" which are "A, B, C, D E" and ignore F, since there is no Sep-16 data for F. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then, using the dimension of A B C D E, it then searches for and group clients income of &amp;lt;=10 in Aug-16. In this case, A B C fits the criteria. With these 3 clients, it sums the cost of Aug-16, (=1 + 3 + 4). &lt;SPAN style="font-size: 13.3333330154419px;"&gt;Because of this, Qlik ignores F, which also have income &amp;lt;= 10, while I want F to be included as well. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I say I'm 95% sure about the above process is because when I switch the selection from Sep-16 to Aug-16, &lt;SPAN style="text-decoration: underline;"&gt;Aug-16 formula works fine&lt;/SPAN&gt;, while &lt;SPAN style="text-decoration: underline;"&gt;Sep-16 formula excludes E&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically, it's a long-winded way of asking how I can make aggr() consider all ClientNames and ignore the current selection. Or is there a better way of achieving the same thing? Please correct me if i'm wrong anywhere or let me know if you need any clarification. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2017 21:12:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/1288042#M403151</guid>
      <dc:creator />
      <dc:date>2017-01-06T21:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore the current selection within aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/1288043#M403152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You shouldn't need to use Aggr-function to achieve what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this expression instead:&lt;/P&gt;&lt;P&gt;Sum(&lt;STRONG&gt;DISTINCT&lt;/STRONG&gt; {&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;ClientName={"=Sum({&amp;lt;Date={'Sep-16'}&amp;gt;} Income)&amp;lt;=10"},Date={'Sep-16'}&amp;gt;} Cost)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum(&lt;STRONG&gt;DISTINCT&lt;/STRONG&gt; {&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;ClientName={"=Sum({&amp;lt;Date={'Aug-16'}&amp;gt;} Income)&amp;lt;=10"},Date={'Aug-16'}&amp;gt;} Cost)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice the DISTINCT and the set identifier 1 (which denotes ALL and not only the currently selected).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2017 22:38:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/1288043#M403152</guid>
      <dc:creator>petter</dc:creator>
      <dc:date>2017-01-06T22:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore the current selection within aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/1288044#M403153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much! It works when I remove the whole aggr() function. Doesn't need the DISTINCT or 1 as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jan 2017 23:14:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/1288044#M403153</guid>
      <dc:creator />
      <dc:date>2017-01-06T23:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Ignore the current selection within aggr() function</title>
      <link>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/2012137#M1221796</link>
      <description>&lt;P&gt;Hi, I met a little same question, But, for my dimension, I need re-define a new dimension based on measure. So i have to use aggr function, so it cause my dimension not the actual all the customers.&lt;/P&gt;
&lt;P&gt;Here is my dimension, I want to divide customer in to 3 types according to OR Type which is CY Till OR- PY Till OR. It only show the customers within month selected. How to shows all the customer?&lt;/P&gt;
&lt;P&gt;Dimension : aggr(if($(OR_Type)&amp;gt;0 ,'With OR Growth',&lt;BR /&gt;if($(OR_Type)&amp;lt;0 or $(OR_Type)=0 and $(V_CY Till_OR) &amp;lt;&amp;gt;0 ,'With OR Decrease',&lt;BR /&gt;if($(V_CY Till_OR)=0 ,'CY Order=0'))), customerID)&lt;/P&gt;
&lt;P&gt;Measure : count(distinct {1}customerID)&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 13:58:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Ignore-the-current-selection-within-aggr-function/m-p/2012137#M1221796</guid>
      <dc:creator>StacyCui</dc:creator>
      <dc:date>2022-12-02T13:58:30Z</dc:date>
    </item>
  </channel>
</rss>

