<?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: Using a condition to apply a variable in set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-a-condition-to-apply-a-variable-in-set-analysis/m-p/1232628#M848759</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use your master calendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a flag in the master calendar to flag the dates / months you want to show in your chart, maybe something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateKey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Year = Year(Today()) or (Month = 12 and Year = Year(Today()-1) and Month(Today())=1 ),1,0) as Flag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use {&amp;lt;Flag = {1}&amp;gt;}&lt;/P&gt;&lt;P&gt;in your set analysis to filter the dates you are interested in.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Mar 2017 17:24:34 GMT</pubDate>
    <dc:creator>swuehl</dc:creator>
    <dc:date>2017-03-17T17:24:34Z</dc:date>
    <item>
      <title>Using a condition to apply a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-condition-to-apply-a-variable-in-set-analysis/m-p/1232627#M848758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My QV application has a number of charts, all designed to show current year data only. However, previous year data is also loaded in via QVD to allow other charts to show specific comparisons between the two years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is in my load script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;vCurrent_Year&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;());&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #0000ff; font-size: 8pt;"&gt;LET&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;vPrevious_Year&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Today&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;())-1; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the current year charts use the following format for the set analysis:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;SUM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;({$&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Year&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;={&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style=": ; color: #808080; font-size: 8pt;"&gt;$(=vCurrent_Year)&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 8pt;"&gt;}&amp;gt;}&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;[Calculated Total]&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works out for 11 months out of the year. However, in January, I want December data from the previous year to remain on the current year charts, as a key function is to show growth or decline from one month to the next. On February 1, it will be acceptable for December data to be removed, and the charts to show a January/February comparison.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What would be the proper way to manage this function? I've had some thoughts, but I am not sure of syntax, and/or if any of them would even work&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;IF statement within the set analysis? ie- IF(Month(Today)= 'Jan',&amp;nbsp; &lt;EM&gt;set analysis to show December of the previous year and January)&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;IF statement as a variable? ie-&amp;nbsp; IF(Month(Today)='Jan', LET vCurrent_Year= &lt;EM&gt;some function to add in December to the calculation)&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;Separate variables for vCurrent_Year and vCurrent_Year_Plus_December, and then an IF statement in the chart to choose the variable?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="text-decoration: underline;"&gt;Side Note&lt;/SPAN&gt;- I have a Master Calendar loaded in per the instructions I found in this community. However ,I have not found a purpose for it in my application. If a Master Calendar is the way to solve this issue, I'm already a step ahead&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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/Using-a-condition-to-apply-a-variable-in-set-analysis/m-p/1232627#M848758</guid>
      <dc:creator>jason_nicholas</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using a condition to apply a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-condition-to-apply-a-variable-in-set-analysis/m-p/1232628#M848759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use your master calendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a flag in the master calendar to flag the dates / months you want to show in your chart, maybe something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateKey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Year = Year(Today()) or (Month = 12 and Year = Year(Today()-1) and Month(Today())=1 ),1,0) as Flag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then use {&amp;lt;Flag = {1}&amp;gt;}&lt;/P&gt;&lt;P&gt;in your set analysis to filter the dates you are interested in.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2017 17:24:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-condition-to-apply-a-variable-in-set-analysis/m-p/1232628#M848759</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2017-03-17T17:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using a condition to apply a variable in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-condition-to-apply-a-variable-in-set-analysis/m-p/1232629#M848760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I knew it had to be simple. thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Mar 2017 17:45:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-condition-to-apply-a-variable-in-set-analysis/m-p/1232629#M848760</guid>
      <dc:creator>jason_nicholas</dc:creator>
      <dc:date>2017-03-17T17:45:53Z</dc:date>
    </item>
  </channel>
</rss>

