<?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 then expressions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220867#M852051</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 03 Mar 2017 13:55:42 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-03-03T13:55:42Z</dc:date>
    <item>
      <title>If then expressions</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220860#M852044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to do an "if then" expression but have not done one in qlikview before&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I currently have the following expression to calculate sales volume variance:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} Tons) - Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons))*(Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanBaseSales)/Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create an "if then" that if the above expression = 0, to then display an amount = &lt;SPAN style="font-size: 13.3333px;"&gt;&lt;STRONG&gt;Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} BaseSales)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it keeps bombing out on me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220860#M852044</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: If then expressions</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220861#M852045</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;= IF(((Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} Tons) - &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons)) * (Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanBaseSales)/Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons))) = 0, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} BaseSales))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 22:00:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220861#M852045</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2017-03-02T22:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: If then expressions</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220862#M852046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;still giving me no values:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="failed if statement.PNG" class="jive-image image-1" src="/legacyfs/online/155080_failed if statement.PNG" style="height: 72px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 22:16:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220862#M852046</guid>
      <dc:creator />
      <dc:date>2017-03-02T22:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: If then expressions</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220863#M852047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is your expected output? Can you share a sample app ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Mar 2017 22:18:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220863#M852047</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2017-03-02T22:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: If then expressions</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220864#M852048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Suppose expression below has Label &lt;STRONG&gt;Exp&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} Tons) - Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons))*(Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanBaseSales)/Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;now add expression&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;if(Exp=0,&lt;STRONG style="font-size: 13.3333px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} BaseSales)&lt;/STRONG&gt;, Exp)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;and hide column Exp in presentation Tab.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Mar 2017 07:01:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220864#M852048</guid>
      <dc:creator>tyagishaila</dc:creator>
      <dc:date>2017-03-03T07:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: If then expressions</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220865#M852049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rephrasing your requirements, if the first two terms are the same (resulting in 0 for the first expression):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If(&lt;STRONG&gt;Sum({$&amp;lt;Year = {$(=Max(Year))}&amp;gt;} Tons)&lt;/STRONG&gt; &amp;lt;&amp;gt; &lt;STRONG&gt;Sum( {$&amp;lt;Year = {$(=Max(Year))}&amp;gt;} PlanTons)&lt;/STRONG&gt;, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; (&lt;STRONG&gt;Sum({$&amp;lt;Year = {$(=Max(Year))}&amp;gt;} Tons&lt;/STRONG&gt;) - &lt;STRONG&gt;Sum( {$&amp;lt;Year = {$(=Max(Year))}&amp;gt;} PlanTons))&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; * &lt;/EM&gt;&lt;EM&gt; (Sum({$&amp;lt;Year = {$(=Max(Year))}&amp;gt;} PlanBaseSales) / Sum({$&amp;lt;Year = {$(=Max(Year))}&amp;gt;} PlanTons)),&lt;/EM&gt;&lt;EM style="font-size: 10pt; line-height: 1.5em;"&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Sum({$&amp;lt;Year={$(=Max(Year))}&amp;gt;} BaseSales)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That simplifies the problem and reduces the calculation, but does not cover the case where PlanBaseSales = 0. If that needs to be considered as well, you will probably need the whole expression in the If condition. In psuedo-code:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If(&amp;lt;expression 1&amp;gt; &amp;lt;&amp;gt; 0, &amp;lt;expression 1&amp;gt;, &amp;lt;expression 2&amp;gt;)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Mar 2017 07:14:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220865#M852049</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2017-03-03T07:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: If then expressions</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220866#M852050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If((Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} Tons) - Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons))*(Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanBaseSales))=0,&lt;/P&gt;&lt;P&gt; Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanBaseSales) ,&lt;/P&gt;&lt;P&gt; (Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} Tons) - Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons))*(Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanBaseSales)/Sum( {$&amp;lt;Year={$(=Max(Year))}&amp;gt;} PlanTons))&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>Fri, 03 Mar 2017 07:51:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220866#M852050</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2017-03-03T07:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: If then expressions</title>
      <link>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220867#M852051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Mar 2017 13:55:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-then-expressions/m-p/1220867#M852051</guid>
      <dc:creator />
      <dc:date>2017-03-03T13:55:42Z</dc:date>
    </item>
  </channel>
</rss>

