<?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: Creating flags for InMTD and InQTD in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1528944#M38018</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;&lt;PRE&gt;If(DayNumberOfQuarter(D) &amp;lt;= DayNumberOfQuarter($(v_Today)) &lt;FONT color="#FF0000"&gt;and QuarterStart(D) = QuarterStart($(v_Today))&lt;/FONT&gt;, 1, 0) as IsInQTD,
If(Day(D) &amp;lt;= Day($(v_Today)) &lt;FONT color="#FF0000"&gt;and MonthStart(D) = MonthStart($(v_Today))&lt;/FONT&gt;, 1, 0) as IsInMTD&lt;/PRE&gt;</description>
    <pubDate>Thu, 10 Jan 2019 12:18:27 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-01-10T12:18:27Z</dc:date>
    <item>
      <title>Creating flags for InMTD and InQTD</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1528790#M38005</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to figure out how to get data for MTD and QTD dynamically. I have this flags created:&amp;nbsp;&lt;/P&gt;&lt;P&gt;If(DayNumberOfYear(D) &amp;lt;= DayNumberOfYear($(v_Today)), 1, 0 ) as IsInYTD,&lt;BR /&gt;If(DayNumberOfQuarter(D) &amp;lt;= DayNumberOfQuarter($(v_Today)), 1, 0) as IsInQTD,&lt;BR /&gt;If(Day(D) &amp;lt;= Day($(v_Today)), 1, 0) as IsInMTD&lt;/P&gt;&lt;P&gt;YTD works fine, when I am doing comparison of the year to date sales to last year to date sales:&lt;/P&gt;&lt;P&gt;Sum( { $&amp;lt;[IsInYTD]={1}, Year ={"$(=Max(Year))"},Month=&amp;gt; }&amp;nbsp;Sales ) - Sum( { $&amp;lt;[IsInYTD]={1}, Year ={"$(=Max(Year)-1)"},Month=&amp;gt; }&amp;nbsp;Sales )&lt;/P&gt;&lt;P&gt;But the same logic doest work for&amp;nbsp;MTD and QTD. It just gives me whole year's sales.&lt;/P&gt;&lt;P&gt;Sum( { &amp;lt;[IsInMTD]= {1}, Year ={"$(=Max(Year))"}&amp;gt; } [Voucher USD Amount] ).&lt;/P&gt;&lt;P&gt;What I needs is to be able to compare data from same periods. For example:&lt;/P&gt;&lt;P&gt;Today is 1/10/2019&lt;/P&gt;&lt;P&gt;When I select year 2018 I want to compare data from 1/1/2018 to 1/10/2018 with data from 1/1/2017 to 1/10/2017&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 08:08:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1528790#M38005</guid>
      <dc:creator>y_grynechko</dc:creator>
      <dc:date>2019-01-10T08:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating flags for InMTD and InQTD</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1528944#M38018</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;PRE&gt;If(DayNumberOfQuarter(D) &amp;lt;= DayNumberOfQuarter($(v_Today)) &lt;FONT color="#FF0000"&gt;and QuarterStart(D) = QuarterStart($(v_Today))&lt;/FONT&gt;, 1, 0) as IsInQTD,
If(Day(D) &amp;lt;= Day($(v_Today)) &lt;FONT color="#FF0000"&gt;and MonthStart(D) = MonthStart($(v_Today))&lt;/FONT&gt;, 1, 0) as IsInMTD&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Jan 2019 12:18:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1528944#M38018</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-01-10T12:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating flags for InMTD and InQTD</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529293#M38064</link>
      <description>&lt;P&gt;Sunny,&lt;/P&gt;&lt;P&gt;thank you for the reply but it works only for the current year. When I select any other year the values go to 0.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 07:39:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529293#M38064</guid>
      <dc:creator>y_grynechko</dc:creator>
      <dc:date>2019-01-11T07:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating flags for InMTD and InQTD</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529452#M38089</link>
      <description>&lt;P&gt;Are you looking to flag each year based on today's month, or quarter?&lt;/P&gt;&lt;P&gt;All of these will be flagged with 1&lt;/P&gt;&lt;P&gt;01/01/2016-01/11/2016&lt;BR /&gt;&lt;SPAN&gt;01/01/2017-01/11/2017&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;01/01/2018-01/11/2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But this isn't based on any other selection, right? So, let's say you select 1st Nov, would you want the quarter flag to change to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;09/01/2016-11/01/2016&lt;BR /&gt;09/01/2017-11/01/2017&lt;BR /&gt;09/01/2018-11/01/2018&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is not what you want, right?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 12:07:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529452#M38089</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-01-11T12:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating flags for InMTD and InQTD</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529505#M38096</link>
      <description>&lt;P&gt;Today is 1/11/2019 So after opening the app I will have 2 KPIs. One to show QTD sum of sales: from 1/1/2019 to 1/11/2019&lt;/P&gt;&lt;P&gt;and the other KPI to show sum of sales&amp;nbsp;&lt;SPAN&gt;1/1/2018 to 1/11/2018. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And this is easy to do but what is need is for it to change when user select different year. For example if user select's year 2017 KPI one will show&amp;nbsp;sum of sales: from 1/1/2017 to 1/11/2017&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and&amp;nbsp;the other KPI to show sum of sales&amp;nbsp;1/1/2016 to 1/11/2016.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Data looks like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="data.JPG" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/3618i15265A46F28DE750/image-size/medium?v=v2&amp;amp;px=400" role="button" title="data.JPG" alt="data.JPG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 13:20:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529505#M38096</guid>
      <dc:creator>y_grynechko</dc:creator>
      <dc:date>2019-01-11T13:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating flags for InMTD and InQTD</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529509#M38097</link>
      <description>&lt;P&gt;Then in that case, try this&lt;/P&gt;&lt;PRE&gt;If(DayNumberOfQuarter(D) &amp;lt;= DayNumberOfQuarter(Today()) and Ceil(Month(D)/3) = Ceil(Month(Today())/3), 1, 0) as IsInQTD,
If(Day(D) &amp;lt;= Day(Today()) and Month(D) = Month(Today()), 1, 0) as IsInMTD&lt;/PRE&gt;&lt;P&gt;But now, make sure to use set analysis on Year field as well&lt;/P&gt;&lt;P&gt;For Max year&lt;/P&gt;&lt;PRE&gt;{&amp;lt;Year = {"$(=Max(Year))"}, IsInMTD = {'1'}&amp;gt;}&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;For Max year minus 1&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;{&amp;lt;Year = {"$(=Max(Year)-1)"}, IsInMTD = {'1'}&amp;gt;}&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jan 2019 13:25:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529509#M38097</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-01-11T13:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating flags for InMTD and InQTD</title>
      <link>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529515#M38098</link>
      <description>&lt;P&gt;It works, thank you Sunny!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 13:44:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Creating-flags-for-InMTD-and-InQTD/m-p/1529515#M38098</guid>
      <dc:creator>y_grynechko</dc:creator>
      <dc:date>2019-01-11T13:44:10Z</dc:date>
    </item>
  </channel>
</rss>

