<?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: If Statement and Set analysis in Pivot Table: excluding a Dimension leads to a wrong calculation. in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799853#M64786</link>
    <description>&lt;P&gt;Thanks for your comment! trying with &lt;SPAN&gt;aggr(), the expressions has no errors but u&lt;/SPAN&gt;nfortunately I'm not getting the desired results.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Apr 2021 18:46:37 GMT</pubDate>
    <dc:creator>RP8</dc:creator>
    <dc:date>2021-04-15T18:46:37Z</dc:date>
    <item>
      <title>If Statement and Set analysis in Pivot Table: excluding a Dimension leads to a wrong calculation.</title>
      <link>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799548#M64769</link>
      <description>&lt;P&gt;Dear Experts!&lt;/P&gt;&lt;P&gt;I've been struggling for two days without results, therefore I ask support to the community.&lt;/P&gt;&lt;P&gt;I have a Pivot Table where the Measure is calculated based on a &lt;FONT color="#800080"&gt;SET ANALYSIS&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;On Top of it, the measure should be calculated multipling by -1&amp;nbsp; based on the &lt;FONT color="#FF9900"&gt;VALUE&lt;/FONT&gt; of a &lt;FONT color="#3366FF"&gt;DIMENSION&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;The expression of the Measure looks similar to this (I'll over-simplify the whole expression, &lt;U&gt;this is not the actual code)&lt;/U&gt;&lt;/P&gt;&lt;P&gt;=IF(&lt;FONT color="#3366FF"&gt;DIMENSION&amp;nbsp;&lt;/FONT&gt; = '&lt;FONT color="#FF9900"&gt;VALUE&lt;/FONT&gt;'), -1, 1) * (&lt;FONT color="#800080"&gt;SET ANALYSIS)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Everything works fine if I add the &lt;FONT color="#3366FF"&gt;DIMENSION&lt;/FONT&gt;&amp;nbsp;as first dimension of my Pivot Table.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;The problem is I need to hide (better totally exclude) the &lt;FONT color="#3366FF"&gt;DIMENSION&lt;/FONT&gt;&amp;nbsp;in the Pivot. &lt;/FONT&gt;&lt;FONT color="#000000"&gt;In this case the "if" statement above&amp;nbsp; fails, and the results have all positive sign.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Below the Details:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;=IF(&lt;FONT color="#3366FF"&gt;AT&lt;/FONT&gt; = '&lt;FONT color="#FF9900"&gt;RE&lt;/FONT&gt;'), -1, 1) *&amp;nbsp;&lt;/FONT&gt;&lt;FONT color="#800080"&gt;Sum({&amp;lt;SA = {'PL'}&amp;gt;*&amp;lt;LL = {'II7'}&amp;gt;*&amp;lt;T= {'[NONE]'}&amp;gt;*&amp;lt;AT -= {'AS'}&amp;gt;*&amp;lt;AT -= {'LI'}&amp;gt;} AMOUNT)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;&lt;FONT color="#000000"&gt;Any idea how to fix this?&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you in advance for your time and help!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;RP&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 17:10:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799548#M64769</guid>
      <dc:creator>RP8</dc:creator>
      <dc:date>2021-04-14T17:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement and Set analysis in Pivot Table: excluding a Dimension leads to a wrong calculation.</title>
      <link>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799588#M64771</link>
      <description>&lt;P&gt;You need to use the Aggr() function.&amp;nbsp; Something like this:&lt;/P&gt;&lt;P&gt;sum(aggr(if(AT='RE',-1,1)*sum(&lt;SPAN&gt;{&amp;lt;SA = {'PL'}&amp;gt;*&amp;lt;LL = {'II7'}&amp;gt;*&amp;lt;T= {'[NONE]'}&amp;gt;*&amp;lt;AT -= {'AS'}&amp;gt;*&amp;lt;AT -= {'LI'}&amp;gt;}&lt;/SPAN&gt; Amount), AT))&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 20:55:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799588#M64771</guid>
      <dc:creator>GaryGiles</dc:creator>
      <dc:date>2021-04-14T20:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement and Set analysis in Pivot Table: excluding a Dimension leads to a wrong calculation.</title>
      <link>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799853#M64786</link>
      <description>&lt;P&gt;Thanks for your comment! trying with &lt;SPAN&gt;aggr(), the expressions has no errors but u&lt;/SPAN&gt;nfortunately I'm not getting the desired results.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 18:46:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799853#M64786</guid>
      <dc:creator>RP8</dc:creator>
      <dc:date>2021-04-15T18:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement and Set analysis in Pivot Table: excluding a Dimension leads to a wrong calculation.</title>
      <link>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799861#M64787</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/139364"&gt;@RP8&lt;/a&gt;&amp;nbsp;, I think what's happening is, if you include the dimension in the table, the If() condition is evaluated for every row and every row has a different AT value, so it works. But if you exclude the dimension from the table, AT is not a single value (unless you select only one), so you should use an aggregation function to get only one value for your comparison, for example:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT color="#000000"&gt;IF(MaxString(&lt;FONT color="#3366FF"&gt;AT)&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;= '&lt;FONT color="#FF9900"&gt;RE&lt;/FONT&gt;'), -1, 1) *&amp;nbsp;&lt;/FONT&gt;&lt;FONT color="#800080"&gt;Sum({&amp;lt;SA = {'PL'}&amp;gt;*&amp;lt;LL = {'II7'}&amp;gt;*&amp;lt;T= {'[NONE]'}&amp;gt;*&amp;lt;AT -= {'AS'}&amp;gt;*&amp;lt;AT -= {'LI'}&amp;gt;} AMOUNT)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#800080"&gt;JG&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Apr 2021 19:08:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-Statement-and-Set-analysis-in-Pivot-Table-excluding-a/m-p/1799861#M64787</guid>
      <dc:creator>JuanGerardo</dc:creator>
      <dc:date>2021-04-15T19:08:01Z</dc:date>
    </item>
  </channel>
</rss>

