<?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 If statement within set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408785#M489640</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am struggling with an if statement I have in an expression of my chart. I am probably way off but the main thing I am trying to accomplish is that if the selcted current month is 'Jan", then sum the data based on a specfic set analysis, if not then sum based on a different set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;A href="Incurred Month"&gt;&lt;/A&gt;='Jan',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum({&amp;lt;[Incurred Year]={$(vMaxYear-1)},[Count Type]={'ACTUAL'},[Incurred Month Num]=12&amp;gt;}[Member Count Adjusted]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum({&amp;lt;[Incurred Year]={$(vMaxYear)},[Incurred Month]=,[Count Type]={'ACTUAL'},[Incurred Month Num]= {$(=vMaxMonth-1)}&amp;gt;}[Member Count Adjusted])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Nov 2012 21:37:39 GMT</pubDate>
    <dc:creator>zagzebski</dc:creator>
    <dc:date>2012-11-06T21:37:39Z</dc:date>
    <item>
      <title>If statement within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408785#M489640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am struggling with an if statement I have in an expression of my chart. I am probably way off but the main thing I am trying to accomplish is that if the selcted current month is 'Jan", then sum the data based on a specfic set analysis, if not then sum based on a different set analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;A href="Incurred Month"&gt;&lt;/A&gt;='Jan',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum({&amp;lt;[Incurred Year]={$(vMaxYear-1)},[Count Type]={'ACTUAL'},[Incurred Month Num]=12&amp;gt;}[Member Count Adjusted]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sum({&amp;lt;[Incurred Year]={$(vMaxYear)},[Incurred Month]=,[Count Type]={'ACTUAL'},[Incurred Month Num]= {$(=vMaxMonth-1)}&amp;gt;}[Member Count Adjusted])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2012 21:37:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408785#M489640</guid>
      <dc:creator>zagzebski</dc:creator>
      <dc:date>2012-11-06T21:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: If statement within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408786#M489641</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;Try like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(GetFieldSelections(Month) = 'Jan',1,0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if(GetFieldSelections(Month) = 'Jan',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({&amp;lt;[Incurred Year]={$(vMaxYear-1)},[Count Type]={'ACTUAL'},[Incurred Month Num]=12&amp;gt;}[Member Count Adjusted]),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum({&amp;lt;[Incurred Year]={$(vMaxYear)},[Incurred Month]=,[Count Type]={'ACTUAL'},[Incurred Month Num]= {$(=vMaxMonth-1)}&amp;gt;}[Member Count Adjusted]))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2012 21:41:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408786#M489641</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2012-11-06T21:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: If statement within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408787#M489642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The way QlikView works, you will get better performance if you take your IF statement into the variable. The variables vMaxYear and vMaxMonth start with an '=' (or at least it should). That means that the variables will be calculated irrespective of chart dimensions, so the whole thing will load quicker. If you include the IF statement in the chart expression, it will be evaluated for each dimension, which will cause a slowdown. Now, you may not actually care about performance if your data set is small, but if it's at all sizeable, I would suggest doing the following with 2 new variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vLastMonthYear &lt;/P&gt;&lt;P&gt;= if(getfieldselections(Month)='Jan',vMaxYear-1,vMaxYear)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vLastMonth&lt;/P&gt;&lt;P&gt;= if(getfieldselections(Month)='Jan',12,vMaxMonth-1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chart expression&lt;/P&gt;&lt;P&gt;sum({&amp;lt;[Incurred Year]={$(vLastMonthYear)},[Count Type]={'ACTUAL'},[Incurred Month Num]={$(vLastMonth)},[Incurred Month]=&amp;gt;}[Member Count Adjusted]) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vlad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2012 22:08:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408787#M489642</guid>
      <dc:creator>vgutkovsky</dc:creator>
      <dc:date>2012-11-06T22:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: If statement within set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408788#M489643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent. this worked great. Thanks much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Nov 2012 18:40:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-within-set-analysis/m-p/408788#M489643</guid>
      <dc:creator>zagzebski</dc:creator>
      <dc:date>2012-11-07T18:40:50Z</dc:date>
    </item>
  </channel>
</rss>

