<?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, greater than and less than MAX in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797592#M64489</link>
    <description>&lt;P&gt;Hi everyone!&amp;nbsp;&lt;BR /&gt;I am trying to create a variable. The result I'm trying to achieve is depending on selected period (YYYYMM) I want the variable to always show selected period-1 to selected period +11 (rolling 12 if you want).&lt;/P&gt;&lt;P&gt;I've created a PeriodCounter that looks correct:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Period&lt;/TD&gt;&lt;TD&gt;PeriodCounter&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202101&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202102&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202103&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202104&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;And then trying this syntax:&lt;/P&gt;&lt;P&gt;vPeriods=&lt;/P&gt;&lt;P&gt;if(PeriodCounter &amp;gt;= '$(=Max(PeriodCounter)-1)' or PeriodCounter &amp;lt; '$(=Max(PeriodCounter)+11)', Period)&lt;/P&gt;&lt;P&gt;and it looks correct:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Meg00_0-1617801129194.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/52552iA5A63CCD3D691C91/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Meg00_0-1617801129194.png" alt="Meg00_0-1617801129194.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;so in this case 202104 is selected, I use the vPeriods as dimension in table, but it only shows 202104.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a feeling I've messed up the syntax somewhere.&lt;/P&gt;&lt;P&gt;Does anyone have a better option or know where I've done something wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 17:18:34 GMT</pubDate>
    <dc:creator>Meg00</dc:creator>
    <dc:date>2024-11-16T17:18:34Z</dc:date>
    <item>
      <title>if statement, greater than and less than MAX</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797592#M64489</link>
      <description>&lt;P&gt;Hi everyone!&amp;nbsp;&lt;BR /&gt;I am trying to create a variable. The result I'm trying to achieve is depending on selected period (YYYYMM) I want the variable to always show selected period-1 to selected period +11 (rolling 12 if you want).&lt;/P&gt;&lt;P&gt;I've created a PeriodCounter that looks correct:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Period&lt;/TD&gt;&lt;TD&gt;PeriodCounter&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202101&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202102&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202103&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;202104&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;And then trying this syntax:&lt;/P&gt;&lt;P&gt;vPeriods=&lt;/P&gt;&lt;P&gt;if(PeriodCounter &amp;gt;= '$(=Max(PeriodCounter)-1)' or PeriodCounter &amp;lt; '$(=Max(PeriodCounter)+11)', Period)&lt;/P&gt;&lt;P&gt;and it looks correct:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Meg00_0-1617801129194.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/52552iA5A63CCD3D691C91/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Meg00_0-1617801129194.png" alt="Meg00_0-1617801129194.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;so in this case 202104 is selected, I use the vPeriods as dimension in table, but it only shows 202104.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a feeling I've messed up the syntax somewhere.&lt;/P&gt;&lt;P&gt;Does anyone have a better option or know where I've done something wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 17:18:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797592#M64489</guid>
      <dc:creator>Meg00</dc:creator>
      <dc:date>2024-11-16T17:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: if statement, greater than and less than MAX</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797596#M64491</link>
      <description>&lt;P&gt;I'd suggest you solve this problem in the load script by creating an AsOf table.&lt;/P&gt;&lt;P&gt;See this article for example: &lt;A href="https://community.qlik.com/t5/QlikView-Documents/Calculating-rolling-n-period-totals-averages-or-other/ta-p/1483033" target="_blank"&gt;https://community.qlik.com/t5/QlikView-Documents/Calculating-rolling-n-period-totals-averages-or-other/ta-p/1483033&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 13:27:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797596#M64491</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2021-04-07T13:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: if statement, greater than and less than MAX</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797598#M64492</link>
      <description>&lt;P&gt;When you say that 202104 is SELECTED I take that to mean that you have physically selected it in a filter. In which case I would fully expect that it is the only that shows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think what you likely need is a DATE ISLAND so that you can select it from the island table which isn't associated to your other data. Then you should be able to accomplish what you are looking to do. Or you can utilize SET ANALYSIS to override the period selection. Not sure of your data model and use case.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is 1 example of a Master Calendar as a Data Island&amp;nbsp;&lt;A href="https://optimalbi.com/crafting-qlik-sense-calendars-part-3-of-4-date-islands/" target="_blank"&gt;https://optimalbi.com/crafting-qlik-sense-calendars-part-3-of-4-date-islands/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 13:29:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797598#M64492</guid>
      <dc:creator>Dalton_Ruer</dc:creator>
      <dc:date>2021-04-07T13:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: if statement, greater than and less than MAX</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797609#M64497</link>
      <description>&lt;P&gt;you're absolutely right, I still had the expression I made for current period in mind and thought I could work from that.&lt;BR /&gt;If( Date#(Period&amp;amp;'01', 'YYYYMMDD') &amp;gt;= MonthStart(AddMonths($(CurrentDate), - 1)) and Date#(Period&amp;amp;'01', 'YYYYMMDD') &amp;lt; MonthStart(AddMonths($(CurrentDate), 11)), Period)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 13:44:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement-greater-than-and-less-than-MAX/m-p/1797609#M64497</guid>
      <dc:creator>Meg00</dc:creator>
      <dc:date>2021-04-07T13:44:30Z</dc:date>
    </item>
  </channel>
</rss>

