<?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: KPI expression for current and last month comparision in Qlik Sense in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585640#M42838</link>
    <description>How about a sample data file with a small amount of fake data?&lt;BR /&gt;&lt;BR /&gt;I can't quite work out what's wrong!</description>
    <pubDate>Tue, 28 May 2019 13:25:08 GMT</pubDate>
    <dc:creator>LReeve</dc:creator>
    <dc:date>2019-05-28T13:25:08Z</dc:date>
    <item>
      <title>KPI expression for current and last month comparision in Qlik Sense</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585447#M42818</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;I am using Qlik Sense and trying to create two KPI's.&lt;/P&gt;&lt;P&gt;One KPI is for the&lt;STRONG&gt; latest month results&lt;/STRONG&gt; and another KPI is for the month results that is &lt;STRONG&gt;before the latest&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I can create KPI for the &lt;STRONG&gt;latest month&lt;/STRONG&gt;, but I am struggling to create one that is &lt;STRONG&gt;before the latest&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the expression I am using to get the latest KPI:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;sum( {$&amp;lt;Sale_Service={[Service messages],[Sales messages]}, year_month = {'$(=max (year_month))'}&amp;gt;} Active_Count )&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;However by using above expression I cannot change between months, meaning if I use filter and choose different months it won't give me result for those months, it will just stay and show &lt;STRONG&gt;latest month.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the expression I used, so KPI can change once I apply filters (unfortunately, it didn't work)&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=sum({&amp;lt;year_month={$(=if(GetSelectedCount(year_month)&amp;lt;=1,chr(39)&amp;amp;max (year_month)&amp;amp;chr(39),chr(39)&amp;amp;GetFieldSelections(year_month,chr(39)&amp;amp;chr(44)&amp;amp;chr(39))&amp;amp;chr(39)))}&amp;gt;} Active_Count )&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, I would need expression, that would show me:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;KPI-1, Latest month results (that can change, if I click on the filter panel and choose different months)&lt;/LI&gt;&lt;LI&gt;KPI-2, One before the latest month results (also changes if I choose specific filters)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 08:53:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585447#M42818</guid>
      <dc:creator>jamesjames</dc:creator>
      <dc:date>2019-05-28T08:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: KPI expression for current and last month comparision in Qlik Sense</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585474#M42823</link>
      <description>&lt;P&gt;Hi James,&lt;/P&gt;&lt;P&gt;I have played around with something and it seems to work in my Desktop April 2019.&lt;/P&gt;&lt;P&gt;For current Month:&lt;/P&gt;&lt;P&gt;=sum( {$&amp;lt;Sale_Service={[Service messages],[Sales messages]}&amp;gt;*&amp;lt; year_month = {'$(=max (year_month))'}&amp;gt;} Active_Count )&lt;/P&gt;&lt;P&gt;For prior Month:&lt;/P&gt;&lt;P&gt;=sum( {$&amp;lt;Sale_Service={[Service messages],[Sales messages]}&amp;gt;*&amp;lt; year_month = {'$(=Addmonths(max (year_month)), -1)'}&amp;gt;} Active_Count )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you YearMonth is formatted as 201905 then you will need to change it from using AddMonths to something like max(year_month) - 1. With some considerations for Jan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 09:36:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585474#M42823</guid>
      <dc:creator>LReeve</dc:creator>
      <dc:date>2019-05-28T09:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: KPI expression for current and last month comparision in Qlik Sense</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585502#M42825</link>
      <description>&lt;P&gt;Thank you for your reply, much appreciated!&lt;/P&gt;&lt;P&gt;Current version is Qlik Sense Februrary 2019 Patch 2, maybe that's the case..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried your expression for current month it didn't work.&lt;/P&gt;&lt;P&gt;and also for the prior month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached image how it looks month values in the data tab, maybe this would help:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="months.PNG" style="width: 184px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/12784i1432772803FE48E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="months.PNG" alt="months.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 10:28:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585502#M42825</guid>
      <dc:creator>jamesjames</dc:creator>
      <dc:date>2019-05-28T10:28:01Z</dc:date>
    </item>
    <item>
      <title>Re: KPI expression for current and last month comparision in Qlik Sense</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585508#M42827</link>
      <description>&lt;P&gt;Could you upload a sample QVF? Unsure&amp;nbsp; why it isn't behaving as expected. Maybe a more experienced user could point out where I am wrong.&lt;/P&gt;&lt;P&gt;The addmonths() would need to change to year_month - 1 or -89 if Max(year_month) was in Jan.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 10:38:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585508#M42827</guid>
      <dc:creator>LReeve</dc:creator>
      <dc:date>2019-05-28T10:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: KPI expression for current and last month comparision in Qlik Sense</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585553#M42833</link>
      <description>&lt;P&gt;I can't unfortunately do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps I could make screenshots and you can tell me what exactly?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards&lt;/P&gt;</description>
      <pubDate>Tue, 28 May 2019 11:49:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585553#M42833</guid>
      <dc:creator>jamesjames</dc:creator>
      <dc:date>2019-05-28T11:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: KPI expression for current and last month comparision in Qlik Sense</title>
      <link>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585640#M42838</link>
      <description>How about a sample data file with a small amount of fake data?&lt;BR /&gt;&lt;BR /&gt;I can't quite work out what's wrong!</description>
      <pubDate>Tue, 28 May 2019 13:25:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/KPI-expression-for-current-and-last-month-comparision-in-Qlik/m-p/1585640#M42838</guid>
      <dc:creator>LReeve</dc:creator>
      <dc:date>2019-05-28T13:25:08Z</dc:date>
    </item>
  </channel>
</rss>

