<?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 statements in Set Analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407061#M561236</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi mate,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may not be the most elegant solution but it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. You need to convert your MONTH to a real month (i.e. numeric underlying value). Do this in your script using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Month(Date#(MONTH,'MMMM'))&lt;/TD&gt;&lt;TD&gt;AS&lt;/TD&gt;&lt;TD&gt;MONTH&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Add a globally calculated variable to get the last month with data of the last year:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vMaxMonthWithBalance:&amp;nbsp; =MaxString({1&amp;lt;YEAR={"$(=Max({&amp;lt;YEAR=,MONTH=&amp;gt;}YEAR))"}&amp;gt;} MONTH)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Use an IF statement in the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(&lt;/P&gt;&lt;P&gt;(SUM ({&amp;lt;YEAR=&amp;gt;} [CUSTOMER BALANCE])/1000000)=0&lt;/P&gt;&lt;P&gt;,(SUM ({&amp;lt;YEAR=,MONTH={$(vMaxMonthWithBalance)}&amp;gt;} [CUSTOMER BALANCE])/1000000)&lt;/P&gt;&lt;P&gt;,(SUM ({&amp;lt;YEAR=&amp;gt;} [CUSTOMER BALANCE])/1000000)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Mar 2013 16:00:56 GMT</pubDate>
    <dc:creator>Jason_Michaelides</dc:creator>
    <dc:date>2013-03-29T16:00:56Z</dc:date>
    <item>
      <title>If statements in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407058#M561231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using Set Analysis to ensure the x-axis in a bar chart ignores the Year filter (so I can show YOY comparisons).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the formula I'm using:&amp;nbsp; SUM ({&amp;lt;YEAR=&amp;gt;} [CUSTOMER BALANCE]) / 1,000,000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since the most recent data included is as of Feb 2013, whenever a later month is selected the latest year shown is 2012.&amp;nbsp; However I'd like the last bar to still show 2013 with the most recent data of that year available.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So let's say the month of December is selected.&amp;nbsp; I would like all previous years (2008 - 2012) to show December information, but I would like 2013 to still show on the chart using February's data.&amp;nbsp; Is this possible?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2013 14:18:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407058#M561231</guid>
      <dc:creator />
      <dc:date>2013-03-29T14:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: If statements in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407059#M561232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you post a sample of your app?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2013 14:23:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407059#M561232</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2013-03-29T14:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: If statements in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407060#M561234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Let's see if this works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2013 14:41:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407060#M561234</guid>
      <dc:creator />
      <dc:date>2013-03-29T14:41:18Z</dc:date>
    </item>
    <item>
      <title>Re: If statements in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407061#M561236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi mate,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This may not be the most elegant solution but it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. You need to convert your MONTH to a real month (i.e. numeric underlying value). Do this in your script using&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Month(Date#(MONTH,'MMMM'))&lt;/TD&gt;&lt;TD&gt;AS&lt;/TD&gt;&lt;TD&gt;MONTH&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Add a globally calculated variable to get the last month with data of the last year:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vMaxMonthWithBalance:&amp;nbsp; =MaxString({1&amp;lt;YEAR={"$(=Max({&amp;lt;YEAR=,MONTH=&amp;gt;}YEAR))"}&amp;gt;} MONTH)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Use an IF statement in the chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF(&lt;/P&gt;&lt;P&gt;(SUM ({&amp;lt;YEAR=&amp;gt;} [CUSTOMER BALANCE])/1000000)=0&lt;/P&gt;&lt;P&gt;,(SUM ({&amp;lt;YEAR=,MONTH={$(vMaxMonthWithBalance)}&amp;gt;} [CUSTOMER BALANCE])/1000000)&lt;/P&gt;&lt;P&gt;,(SUM ({&amp;lt;YEAR=&amp;gt;} [CUSTOMER BALANCE])/1000000)&lt;/P&gt;&lt;P&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2013 16:00:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407061#M561236</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2013-03-29T16:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: If statements in Set Analysis</title>
      <link>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407062#M561239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Who needs elegance?&amp;nbsp; Not only did this work - but it taught me a few other things about Qlikview that I didn't previously know (using both Load and SQL Select in the script, adding variables, etc.).&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I really appreciate the help Jason!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Apr 2013 18:10:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statements-in-Set-Analysis/m-p/407062#M561239</guid>
      <dc:creator />
      <dc:date>2013-04-01T18:10:49Z</dc:date>
    </item>
  </channel>
</rss>

