<?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: Eliminating if statement in expressions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1778578#M455041</link>
    <description>&lt;P&gt;GetFieldSelections() will not give when you use aggregate, rather you can try this way&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(&lt;FONT color="#FF0000"&gt;GetSelectedCount(TestField1)&lt;/FONT&gt;=0,num(FABS(SUM({1&amp;lt;Year={"=GetFieldSelections(Year)"},Scenario={'X'},[TestFIeld1]-={'Retail'}&amp;gt;}Sales))/1000000,'###,###.#'),num(FABS(SUM({1&amp;lt;Year={"&lt;FONT color="#FF0000"&gt;$(=Concat(DISTINCT Chr(39) &amp;amp; Year &amp;amp; Chr(39), '',''))&lt;/FONT&gt;"},Scenario={'X'},[TestFIeld1]=$::[TestFIeld1]&amp;gt;}Sales))/1000000,'###,###.#'))&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jan 2021 19:59:05 GMT</pubDate>
    <dc:creator>Anil_Babu_Samineni</dc:creator>
    <dc:date>2021-01-29T19:59:05Z</dc:date>
    <item>
      <title>Eliminating if statement in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1778235#M455032</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have several expressions that use if statements, where two different set analysis calculations are performed based on field selection count. Is there a way to rewrite this expression without using an if statement?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;=if(&lt;STRONG&gt;count(getfieldselections([TestFIeld1]))=0&lt;/STRONG&gt;,num(FABS(SUM({1&amp;lt;Year={"=GetFieldSelections(Year)"},Scenario={'X'},[TestFIeld1]-={'Retail'}&amp;gt;}Sales))/1000000,'###,###.#'),&lt;STRONG&gt;num(FABS(SUM({1&amp;lt;Year={"=GetFieldSelections(Year)"},Scenario={'X'},[TestFIeld1]=$::[TestFIeld1]&amp;gt;}Sales))/1000000,'###,###.#')&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jan 2021 19:36:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1778235#M455032</guid>
      <dc:creator>Tatalay2021</dc:creator>
      <dc:date>2021-01-28T19:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Eliminating if statement in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1778578#M455041</link>
      <description>&lt;P&gt;GetFieldSelections() will not give when you use aggregate, rather you can try this way&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(&lt;FONT color="#FF0000"&gt;GetSelectedCount(TestField1)&lt;/FONT&gt;=0,num(FABS(SUM({1&amp;lt;Year={"=GetFieldSelections(Year)"},Scenario={'X'},[TestFIeld1]-={'Retail'}&amp;gt;}Sales))/1000000,'###,###.#'),num(FABS(SUM({1&amp;lt;Year={"&lt;FONT color="#FF0000"&gt;$(=Concat(DISTINCT Chr(39) &amp;amp; Year &amp;amp; Chr(39), '',''))&lt;/FONT&gt;"},Scenario={'X'},[TestFIeld1]=$::[TestFIeld1]&amp;gt;}Sales))/1000000,'###,###.#'))&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jan 2021 19:59:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1778578#M455041</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2021-01-29T19:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Eliminating if statement in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1780587#M455131</link>
      <description>&lt;P&gt;Thanks for your feedback!&lt;/P&gt;&lt;P&gt;I should have stated this in my original post but the motivation behind this post was given what I have read elsewhere in the community about if statement impacting performance. Thus, I was trying to understand if the expression I listed is one of those situation that would need to be rewritten without including if statement. But as I think about it more perhaps that may not be applicable in this situation as I am essentially two different evaluations based on the applicable condition.&lt;/P&gt;&lt;P&gt;Nevertheless, I appreciate your input and will consider giving it a try in my next work.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 16:38:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1780587#M455131</guid>
      <dc:creator>Tatalay2021</dc:creator>
      <dc:date>2021-02-05T16:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: Eliminating if statement in expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1780630#M455136</link>
      <description>&lt;P&gt;First of all, I don't see any performance issue. did you?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 20:51:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Eliminating-if-statement-in-expressions/m-p/1780630#M455136</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2021-02-05T20:51:20Z</dc:date>
    </item>
  </channel>
</rss>

