<?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 set analysis expression -- using if sentence under 2 scenarios in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/set-analysis-expression-using-if-sentence-under-2-scenarios/m-p/580061#M1099984</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all, I have a question about using if statement and set analysis to calculate sales:&lt;/P&gt;&lt;P&gt;the calculation are under 2 scenarios, one is past_trips &amp;gt; 0 and isnull(cancellation_date) = 1; one is past_trips &amp;gt; 0 and isnull(cancellation_date) = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then we calculate the total with set values for certain variables, the expression is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;if(past_trips &amp;gt; 0 and isnull(cancellation_date) = 1, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;sum({&amp;lt;fiscal = {'$(vLastFY)'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;&amp;nbsp; [deposit_date] = {"&amp;lt;=$(=TimeStamp(vToday_Y-1))"}&amp;gt;} 1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;+ &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;if(past_trips &amp;gt; 0 and isnull(cancellation_date) = 0, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;sum({&amp;lt;fiscal = {'$(vLastFY)'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;&amp;nbsp; [deposit_date] = {"&amp;lt;=$(=TimeStamp(vToday_Y-1))"},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;&amp;nbsp; [cancellation_date] = {"&amp;gt;=$(=TimeStamp(vToday_Y-1))"}&amp;gt;} 1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;vToday_Y-1 is dynamic variable: =makedate(year(today())-1, month(today()), day(today()))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Is there anything wrong with this expression? Thanks so much for the help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Xuan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Apr 2014 16:10:38 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-04-15T16:10:38Z</dc:date>
    <item>
      <title>set analysis expression -- using if sentence under 2 scenarios</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-expression-using-if-sentence-under-2-scenarios/m-p/580061#M1099984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all, I have a question about using if statement and set analysis to calculate sales:&lt;/P&gt;&lt;P&gt;the calculation are under 2 scenarios, one is past_trips &amp;gt; 0 and isnull(cancellation_date) = 1; one is past_trips &amp;gt; 0 and isnull(cancellation_date) = 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then we calculate the total with set values for certain variables, the expression is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;if(past_trips &amp;gt; 0 and isnull(cancellation_date) = 1, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;sum({&amp;lt;fiscal = {'$(vLastFY)'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;&amp;nbsp; [deposit_date] = {"&amp;lt;=$(=TimeStamp(vToday_Y-1))"}&amp;gt;} 1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;+ &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;if(past_trips &amp;gt; 0 and isnull(cancellation_date) = 0, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;sum({&amp;lt;fiscal = {'$(vLastFY)'},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;&amp;nbsp; [deposit_date] = {"&amp;lt;=$(=TimeStamp(vToday_Y-1))"},&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #993366;"&gt;&amp;nbsp; [cancellation_date] = {"&amp;gt;=$(=TimeStamp(vToday_Y-1))"}&amp;gt;} 1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;vToday_Y-1 is dynamic variable: =makedate(year(today())-1, month(today()), day(today()))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Is there anything wrong with this expression? Thanks so much for the help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Xuan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2014 16:10:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-expression-using-if-sentence-under-2-scenarios/m-p/580061#M1099984</guid>
      <dc:creator />
      <dc:date>2014-04-15T16:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: set analysis expression -- using if sentence under 2 scenarios</title>
      <link>https://community.qlik.com/t5/QlikView/set-analysis-expression-using-if-sentence-under-2-scenarios/m-p/580062#M1099985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I solved it,&amp;nbsp; better use set analysis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=count({&amp;lt;fiscal = {'$(vLastFY)'},&lt;/P&gt;&lt;P&gt;&amp;nbsp; [past_trips] -= {'0'},&lt;/P&gt;&lt;P&gt;&amp;nbsp; [deposit_date] = {"&amp;lt;=$(=TimeStamp(vToday_1Y_Ago))"},&lt;/P&gt;&lt;P&gt;&amp;nbsp; [cancellation_date] = {"&amp;gt;=$(=TimeStamp(vToday_1Y_Ago))"}&amp;gt;} trip_no) + &lt;/P&gt;&lt;P&gt; count({&amp;lt;fiscal = {'$(vLastFY)'},&lt;/P&gt;&lt;P&gt;&amp;nbsp; [past_trips] -= {'0'},&lt;/P&gt;&lt;P&gt;&amp;nbsp; [deposit_date] = {"&amp;lt;=$(=TimeStamp(vToday_1Y_Ago))"},&lt;/P&gt;&lt;P&gt;&amp;nbsp; [status] = {'BK','WL','RQ'} &amp;gt;} trip_no)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2014 19:10:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/set-analysis-expression-using-if-sentence-under-2-scenarios/m-p/580062#M1099985</guid>
      <dc:creator />
      <dc:date>2014-04-15T19:10:42Z</dc:date>
    </item>
  </channel>
</rss>

