<?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: How to make a KPI Show last months value in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842103#M69724</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/151284"&gt;@GrizzlyBestia&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use below expressions&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current Month : Sum({$ &amp;lt; &lt;SPAN&gt;CalDate&lt;/SPAN&gt;={"$(='&amp;gt;=' &amp;amp; Date(MonthStart(Max(&lt;SPAN&gt;CalDate&lt;/SPAN&gt;)), 'MM/DD/YYYY') &amp;amp; '&amp;lt;=' &amp;amp; Date((Max(&lt;SPAN&gt;CalDate&lt;/SPAN&gt;)), 'MM/DD/YYYY'))"}&amp;gt;} [#TransactionCount])&lt;BR /&gt;&lt;BR /&gt;Last Month : Sum({$ &amp;lt;&lt;SPAN&gt;CalDate&lt;/SPAN&gt;={"$(='&amp;gt;=' &amp;amp; Date(MonthStart(Max(&lt;SPAN&gt;CalDate&lt;/SPAN&gt;),-1), 'MM/DD/YYYY') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(&lt;SPAN&gt;CalDate&lt;/SPAN&gt;),-1), 'MM/DD/YYYY'))"}&amp;gt;} [#TransactionCount])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Oct 2021 11:01:30 GMT</pubDate>
    <dc:creator>abhijitnalekar</dc:creator>
    <dc:date>2021-10-05T11:01:30Z</dc:date>
    <item>
      <title>How to make a KPI Show last months value</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842054#M69718</link>
      <description>&lt;LI-SPOILER&gt;Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I am currently trying to make a KPI that shows the average Paid Weight (kg) for a selected month and the previous month.&lt;BR /&gt;&lt;BR /&gt;However my formula is not calculating a value in my set analysis it is just returning - .&lt;BR /&gt;&lt;BR /&gt;I am just trying to have a current value shown over last months value. Any help would be greatly appreicated.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The below image is the value for September 2021, I want to show the value for August 2021 also.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrizzlyBestia_0-1633427361790.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/63366i79FF89DEDE3FE91D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrizzlyBestia_0-1633427361790.png" alt="GrizzlyBestia_0-1633427361790.png" /&gt;&lt;/span&gt;&amp;nbsp;Avg({&amp;lt;[DataType]={'Actual'}&amp;gt;}[Cold Weight])&lt;BR /&gt;&lt;BR /&gt;The Value for August 2021 can be seen below:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrizzlyBestia_1-1633427445182.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/63367i32E705B0BC78C9FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrizzlyBestia_1-1633427445182.png" alt="GrizzlyBestia_1-1633427445182.png" /&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrizzlyBestia_2-1633427465210.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/63368i9A40D5140F90D910/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrizzlyBestia_2-1633427465210.png" alt="GrizzlyBestia_2-1633427465210.png" /&gt;&lt;/span&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;None of my solutions seem to provide an answer they simple return - , see below for my several attempts.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Avg({&amp;lt;[DataType]={'Actual'},MonthMin={'$(=date(AddMonths(MonthA,-Months_Back)))'}&amp;gt;}[Cold Weight])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Avg({&amp;lt;[DataType]={'Actual'},MonthMin={'$(=date(AddMonths(MonthA,-Months_Back),'MM-yyyy'))'}&amp;gt;}[Cold Weight])&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Avg({&amp;lt;[DataType]={'Actual'},MonthA={'$(=date(AddMonths(MonthA,-Months_Back)))'}&amp;gt;}[Cold Weight])&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Avg({&amp;lt;[DataType]={'Actual'},MonthMin={'$(=date(AddMonths(MonthA,-Months_Back)))'},MonthMax={'$(=date(monthend(AddMonths(MonthA,-Months_Back))))'}&amp;gt;}[Cold Weight])&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Avg({&amp;lt;[DataType]={'Actual'},MonthMin={'$(=date(AddMonths(MonthA,-Months_Back)))'},MonthMax={'$(=date(monthend(MonthMin)))'}&amp;gt;}[Cold Weight])&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Avg({&amp;lt;[DataType]={'Actual'},MonthMin={'$(=date(AddMonths(MonthA,-Months_Back)))'}&amp;gt;}[Cold Weight])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Tue, 05 Oct 2021 09:52:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842054#M69718</guid>
      <dc:creator>GrizzlyBestia</dc:creator>
      <dc:date>2021-10-05T09:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a KPI Show last months value</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842081#M69720</link>
      <description>&lt;P&gt;Do data have a Date field?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 10:34:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842081#M69720</guid>
      <dc:creator>abhijitnalekar</dc:creator>
      <dc:date>2021-10-05T10:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a KPI Show last months value</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842094#M69722</link>
      <description>&lt;P&gt;I do have a date filed named CalDate. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 10:52:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842094#M69722</guid>
      <dc:creator>GrizzlyBestia</dc:creator>
      <dc:date>2021-10-05T10:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a KPI Show last months value</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842103#M69724</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/151284"&gt;@GrizzlyBestia&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use below expressions&amp;nbsp;&lt;/P&gt;&lt;P&gt;Current Month : Sum({$ &amp;lt; &lt;SPAN&gt;CalDate&lt;/SPAN&gt;={"$(='&amp;gt;=' &amp;amp; Date(MonthStart(Max(&lt;SPAN&gt;CalDate&lt;/SPAN&gt;)), 'MM/DD/YYYY') &amp;amp; '&amp;lt;=' &amp;amp; Date((Max(&lt;SPAN&gt;CalDate&lt;/SPAN&gt;)), 'MM/DD/YYYY'))"}&amp;gt;} [#TransactionCount])&lt;BR /&gt;&lt;BR /&gt;Last Month : Sum({$ &amp;lt;&lt;SPAN&gt;CalDate&lt;/SPAN&gt;={"$(='&amp;gt;=' &amp;amp; Date(MonthStart(Max(&lt;SPAN&gt;CalDate&lt;/SPAN&gt;),-1), 'MM/DD/YYYY') &amp;amp; '&amp;lt;=' &amp;amp; Date(AddMonths(Max(&lt;SPAN&gt;CalDate&lt;/SPAN&gt;),-1), 'MM/DD/YYYY'))"}&amp;gt;} [#TransactionCount])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 11:01:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842103#M69724</guid>
      <dc:creator>abhijitnalekar</dc:creator>
      <dc:date>2021-10-05T11:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to make a KPI Show last months value</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842134#M69727</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I have found a solution for this issue so I thought I'd share it.&lt;/P&gt;&lt;P&gt;I created an inline table to hold number of months a user wishes to look back. This selection drives how far the user wishes to look back in number of months:&lt;/P&gt;&lt;P&gt;MonthBack:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Months_Back&lt;BR /&gt;0,&lt;BR /&gt;1,&lt;BR /&gt;2,&lt;BR /&gt;3,&lt;BR /&gt;4,&lt;BR /&gt;5,&lt;BR /&gt;6,&lt;BR /&gt;7,&lt;BR /&gt;8,&lt;BR /&gt;9,&lt;BR /&gt;10,&lt;BR /&gt;11,&lt;BR /&gt;12&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;In the load editor I created a Min month and Max month variable in my calendar which I will use for this function.&lt;/P&gt;&lt;P&gt;MonthName(date(CalDate)) as [MonthA],//[Cal Month]&lt;BR /&gt;MonthName(date(CalDate)) as [MonthMin], // -&amp;gt; this is to show the start of the month&lt;BR /&gt;MonthName(date(CalDate)) as [MonthMax], // -&amp;gt; this is to show the end of the month&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;This is loaded into my App in the filterPane as a dropdown list called Months_Back, the default value is set to 0, so that the user will always see the same value at first. Once the user selects 1 it will show 1 month ago's results.&lt;/P&gt;&lt;P&gt;To get the comparison to work for the second KPI I had to tell the function to IGNORE the initial date selection MonthA using:&amp;nbsp;&lt;STRONG&gt;, MonthA=&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp;after declaring the field. This allowed Qlik to create another date selection.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now that the initial month selection is being ignored you are free to start the set analysis.&lt;/P&gt;&lt;P&gt;By keeping an eye on the debugging bar at the bottom of the page allows a user to see clearly what is being analysed. You can see below that the formula states:&lt;/P&gt;&lt;P&gt;If MonthMin &amp;gt;= 01/08/2021 &amp;lt;=31/08/2021 then get the Cold Weight.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrizzlyBestia_0-1633434078111.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/63390i5FECA7C180C6EBD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrizzlyBestia_0-1633434078111.png" alt="GrizzlyBestia_0-1633434078111.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To calculate the MonthMax field:&amp;nbsp;&lt;STRONG&gt;=date(monthend(AddMonths(MonthA,-Months_Back))))&amp;nbsp;&lt;/STRONG&gt;provides the last day of the month.&lt;/P&gt;&lt;P&gt;The full formula can be seen below:&lt;/P&gt;&lt;P&gt;Avg({&amp;lt;[DataType]={'Actual'}&lt;STRONG&gt;, MonthA=&lt;/STRONG&gt;, MonthMin={"&amp;gt;=$(=date(AddMonths(MonthA,-Months_Back))) &amp;lt;=$(=date(monthend(AddMonths(MonthA,-Months_Back))))"}&amp;gt;}[Cold Weight])&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrizzlyBestia_1-1633434486351.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/63391iEEB2AF9150C23816/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrizzlyBestia_1-1633434486351.png" alt="GrizzlyBestia_1-1633434486351.png" /&gt;&lt;/span&gt;&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="GrizzlyBestia_2-1633434494179.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/63392i5F9FC6EA7D7F16BB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrizzlyBestia_2-1633434494179.png" alt="GrizzlyBestia_2-1633434494179.png" /&gt;&lt;/span&gt;This is showing Septembers figure against Augusts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps somebody &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Oct 2021 11:48:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-make-a-KPI-Show-last-months-value/m-p/1842134#M69727</guid>
      <dc:creator>GrizzlyBestia</dc:creator>
      <dc:date>2021-10-05T11:48:29Z</dc:date>
    </item>
  </channel>
</rss>

