<?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 Expression with if() and aggr() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354247#M495143</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition: removing the if from the expression and only using: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avg(aggr(AggrExpr1,AggrDim))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also gives me only 1 result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Mar 2012 11:55:07 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-03-15T11:55:07Z</dc:date>
    <item>
      <title>Expression with if() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354246#M495142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a very weird problem with a a chart expression. The simplified problem: I have a table with a dimension going from 1 to 10. My expression needs to be calculated depending on the dimension. So I write as expression (with DIM the dimension):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (DIM=1, valueForDim1,&lt;/P&gt;&lt;P&gt;if (DIM=2, valueForDim2,&lt;/P&gt;&lt;P&gt;if (DIM=3, valueForDim3, [...]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Normally this doesn't give me any problems. However this time I need to use the &lt;STRONG&gt;advanced aggregation function&lt;/STRONG&gt; (with AggrDim the aggregation dimension and AggrExpr the aggregation expression):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if (DIM=1, avg(aggr(AggrExpr1,AggrDim)),&lt;/P&gt;&lt;P&gt;if (DIM=2, avg(aggr(AggrExpr2,AggrDim)),&lt;/P&gt;&lt;P&gt;if (DIM=3, avg(aggr(AggrExpr3,AggrDim)), [...]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I &lt;STRONG&gt;only get a result for my first dimension&lt;/STRONG&gt;! The other dimensions are not calculated! When I delete the if(DIM=1...) then I only get a result for the second dimension (and so on). The aggregations work like a charm when I use them outside the if() clauses.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how to fix this? Is this a bug? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 11:51:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354246#M495142</guid>
      <dc:creator />
      <dc:date>2012-03-15T11:51:44Z</dc:date>
    </item>
    <item>
      <title>Expression with if() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354247#M495143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition: removing the if from the expression and only using: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;avg(aggr(AggrExpr1,AggrDim))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also gives me only 1 result.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 11:55:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354247#M495143</guid>
      <dc:creator />
      <dc:date>2012-03-15T11:55:07Z</dc:date>
    </item>
    <item>
      <title>Expression with if() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354248#M495144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok it clearly is a problem with my datastructure: somehow the chart dimension conflicts with the aggregation dimension. Meaning that in any other situation the above works without a problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 12:03:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354248#M495144</guid>
      <dc:creator />
      <dc:date>2012-03-15T12:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Expression with if() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354249#M495145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your problem description let me assume that the issue is related to the implicite DISTINCT qualifier of the aggr() function, so you might want to try an explicite NODISTINCT. &lt;/P&gt;&lt;P&gt;Though this might result in showing some numbers for each dimension value, the actual resulting numbers might be wrong. &lt;/P&gt;&lt;P&gt;Without knowing your specific data model, dimensions, expressions and requirements, it hard to tell more for now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;Another suggestion: Use pick() function instead of multiple embedded if() statements, like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=pick(DIMENSION,&lt;/P&gt;&lt;P&gt;Expression1,&lt;/P&gt;&lt;P&gt;Expression2,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 13:25:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354249#M495145</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-03-15T13:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Expression with if() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354250#M495146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's right. I found that out just trying a couple of things without really knowing what I'm doing. Using the NODISTINCT that works very well. Although I have to ressearch if the results are indeed OK. But I have no idea what the difference is between the default and the NODISTINCT aggregations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the tip about the pick() function!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 13:35:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354250#M495146</guid>
      <dc:creator />
      <dc:date>2012-03-15T13:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Expression with if() and aggr()</title>
      <link>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354251#M495147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A question about this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If the expression argument is preceded by the nodistinct qualifier, each combination of dimension values&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;may generate more than one return value, depending on underlying data structure.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;(from the reference guide)&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With 'combination of dimension values', do they mean the dimension of the chart on the one hand and the dimension of the aggr() function on the other?&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Mar 2012 13:44:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Expression-with-if-and-aggr/m-p/354251#M495147</guid>
      <dc:creator />
      <dc:date>2012-03-15T13:44:09Z</dc:date>
    </item>
  </channel>
</rss>

