<?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: How to ignore selection in an if statement expression? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94813#M15215</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try putting your 'If' withing only(), like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Only( {&amp;lt;Year&amp;gt;}&lt;/STRONG&gt; If(...&amp;lt;your expression&amp;gt;)&lt;STRONG&gt; )&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Jul 2018 09:43:53 GMT</pubDate>
    <dc:creator>tresB</dc:creator>
    <dc:date>2018-07-17T09:43:53Z</dc:date>
    <item>
      <title>How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94810#M15212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose i have a table with two dimensions (KPI and YEAR).&lt;/P&gt;&lt;P&gt;I want to set the expression based on the KPI dimension while ignoring the selection in the YEAR dimension. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(KPI = 'KPI1'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SUM({&amp;lt;YEAR = &amp;gt;} VALUE)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SUM({&amp;lt;YEAR = &amp;gt;} VALUE)/2&lt;/P&gt;&lt;P&gt;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when I make a selection in the YEAR dimension, the year is not filtered in the table (that's good), but all the years which were not selected are evaluated as not meeting the condition of the if statement and are calculated with the second ("else") expression (&lt;SPAN style="font-size: 13.3333px;"&gt;SUM({&amp;lt;YEAR = &amp;gt;} VALUE)/2&lt;/SPAN&gt;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, the table with no selections made:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="208030" alt="IgnoreProblem1.PNG" class="jive-image image-1" height="255" src="https://community.qlik.com/legacyfs/online/208030_IgnoreProblem1.PNG" style="height: 255.285px; width: 379px;" width="379" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And when I select year 2017: values for KPI1 - 2016 and KPI1 - 2018 are evaluated by the ELSE clause, as if KPI would not equal 'KPI1' for them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="208034" alt="IgnoreProblem2.PNG" class="jive-image image-2" height="257" src="https://community.qlik.com/legacyfs/online/208034_IgnoreProblem2.PNG" style="height: 257px; width: 380.513px;" width="381" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have an idea how to truly ignore the selection in and if statement?&lt;/P&gt;&lt;P&gt;Rewriting the expression like this:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YEAR = &amp;gt;} if(KPI = 'KPI1',VALUE, VALUE/2))&lt;/P&gt;&lt;P&gt;works in this example, but I cannot use it in my real life application (expressions combine more aggregation functions).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You for any ideas!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 08:59:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94810#M15212</guid>
      <dc:creator>qw_jakub</dc:creator>
      <dc:date>2018-07-17T08:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94811#M15213</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;I think it is not working as expected for you because on the aggregation you have on your expression, would you be able to share the final expression with all the aggregation ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;actually you need to exclude the year on every aggregation function&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:19:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94811#M15213</guid>
      <dc:creator>YoussefBelloum</dc:creator>
      <dc:date>2018-07-17T09:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94812#M15214</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;In my real life application I have a set of KPIs which are mostly calculated in a standard way (SUM(VALUE)) but I have some KPIs which need to be calculated in a different more complicate way.&lt;/P&gt;&lt;P&gt;It looks something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(KPI = 'KPI1'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , (sum(TOTAL &amp;lt;YEAR&amp;gt; {&amp;lt;YEAR = , KPI = {'KPI3'}&amp;gt;} VALUE) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; / sum(TOTAL &amp;lt;YEAR&amp;gt;&amp;nbsp; {&amp;lt;YEAR = , KPI = {'KPI2'}&amp;gt;} VALUE)) ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SUM({&amp;lt;YEAR = &amp;gt;} VALUE)/2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine when no YEAR is selected, but when I select a year, for KPI1 it is calculated right only for the selected year. The other years are calculated by the else clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also updated the example application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:37:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94812#M15214</guid>
      <dc:creator>qw_jakub</dc:creator>
      <dc:date>2018-07-17T09:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94813#M15215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try putting your 'If' withing only(), like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Only( {&amp;lt;Year&amp;gt;}&lt;/STRONG&gt; If(...&amp;lt;your expression&amp;gt;)&lt;STRONG&gt; )&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:43:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94813#M15215</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2018-07-17T09:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94814#M15216</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.qlik.com/qlik-users/26418"&gt;tresesco&lt;/A&gt;&lt;/P&gt;&lt;P&gt;he will need to use AGGR() on the KPI and YEAR dimensions before ONLY() right ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:48:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94814#M15216</guid>
      <dc:creator>YoussefBelloum</dc:creator>
      <dc:date>2018-07-17T09:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94815#M15217</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Probably. I din't even go through the entire discussion and quickly jumped into proposing a solution. &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/silly.png" /&gt; Let me have re-look at the requirement in bit more detail.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:51:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94815#M15217</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2018-07-17T09:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94816#M15218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, because it is a bit weird here, I have doubts about the if and the values set on the set analysis&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:53:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94816#M15218</guid>
      <dc:creator>YoussefBelloum</dc:creator>
      <dc:date>2018-07-17T09:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94817#M15219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tried this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only( {&amp;lt;YEAR=&amp;gt;} aggr(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(KPI = 'KPI1',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({&amp;lt;YEAR=&amp;gt;} VALUE),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUM({&amp;lt;YEAR=&amp;gt;}VALUE)/2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , YEAR, KPI))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the behavior is the same. When I select a Year, for the KPI1 the other years get calculated by the IF clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:57:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94817#M15219</guid>
      <dc:creator>qw_jakub</dc:creator>
      <dc:date>2018-07-17T09:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94818#M15220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Only({&amp;lt;YEAR&amp;gt;}&lt;/STRONG&gt; Aggr( if(&lt;STRONG&gt;only({&amp;lt;YEAR&amp;gt;}KPI)&lt;/STRONG&gt; = 'KPI1',&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YEAR&amp;gt;} VALUE),&lt;/P&gt;&lt;P&gt;SUM({&amp;lt;YEAR&amp;gt;} VALUE)/2)&lt;/P&gt;&lt;P&gt;, YEAR, KPI)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 10:06:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94818#M15220</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2018-07-17T10:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to ignore selection in an if statement expression?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94819#M15221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works, how I wanted!&lt;/P&gt;&lt;P&gt;After a little tuning, it turns out that just adding the set analysis (in an only function) to the IF statements does the job:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(&lt;STRONG&gt;Only({&amp;lt;YEAR = &amp;gt;} KPI)&lt;/STRONG&gt; = 'KPI1',&lt;/P&gt;&lt;P&gt;sum({&amp;lt;YEAR = &amp;gt;} VALUE),&lt;/P&gt;&lt;P&gt;SUM({&amp;lt;YEAR = &amp;gt;} VALUE)/2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You both for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jul 2018 10:13:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-ignore-selection-in-an-if-statement-expression/m-p/94819#M15221</guid>
      <dc:creator>qw_jakub</dc:creator>
      <dc:date>2018-07-17T10:13:48Z</dc:date>
    </item>
  </channel>
</rss>

