<?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: Measures that calculate KPIs for the previous month. in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065915#M87436</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you have debug the expression by parts&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=Max(OrderDate)&lt;/P&gt;
&lt;P&gt;=AddMonths(Max(OrderDate), -1)&lt;/P&gt;
&lt;P&gt;=MonthStart(AddMonths(Max(OrderDate), -1))&lt;/P&gt;
&lt;P&gt;=MonthEnd(AddMonths(Max(OrderDate), -1&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And check where is the issue...and check the order date is formatted&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Apr 2023 16:44:29 GMT</pubDate>
    <dc:creator>Chanty4u</dc:creator>
    <dc:date>2023-04-28T16:44:29Z</dc:date>
    <item>
      <title>Measures that calculate KPIs for the previous month.</title>
      <link>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065274#M87369</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I am entirely new to Qlik and I have only just started to try and build some measures. I am entirely new to the syntax, but I have read about the basics of measure syntax.&lt;/P&gt;
&lt;P&gt;I am using a dummy data set so the data is not real, and it is not up to date or recent, I think the latest date in the data is around 2017 and the measure I am trying to create is based off of months and previous months.&lt;/P&gt;
&lt;P&gt;I created a test measure called Total Revenue and used the syntax:&lt;/P&gt;
&lt;P&gt;Total Revenue =&amp;nbsp;&lt;SPAN&gt;Sum(OrderQuantity)*Sum(ProductPrice)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I'm aware that even this syntax may be wrong (any advice on that would be greatly appreciated too), but I then wanted to create a measure that I could use for a KPI showing the previous month's revenue based on the first measure.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I have read some other forum posts on similar issues but I am having problems changing the measures to suit my needs.&lt;/P&gt;
&lt;P&gt;Any help on the matter would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;Thank you for reading.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 12:57:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065274#M87369</guid>
      <dc:creator>krisk</dc:creator>
      <dc:date>2023-04-27T12:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Measures that calculate KPIs for the previous month.</title>
      <link>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065327#M87378</link>
      <description>&lt;P&gt;first off, you dont multiple the sums to get the revenuew, you sum the product:&lt;BR /&gt;&lt;SPAN&gt;Total Revenue =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Sum(OrderQuantity*ProductPrice)&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;there is a post somewhere that discusses the AS OF CALENDAR - cant find it rt now but others may have it in their FAV or you can look it up.&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;there are also other ways of&amp;nbsp; getting data for previous months - one is to build a bridge (in line with the as of calendar) or simpler create variables and use that in your set analysis.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;for example if the user selects a MONTH, you can create a variable that calculates the previous month (see&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense/February2023/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFunctions/addmonths.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense/February2023/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFunctions/addmonths.htm&lt;/A&gt; )&lt;BR /&gt;you can then store that in your variable and in your expression:&lt;BR /&gt;&lt;BR /&gt;Revenue:&lt;BR /&gt;sum({&amp;lt;MONTH={'$(vPreviousMonth)'}&amp;gt;}Quantity * Order)&lt;BR /&gt;&lt;BR /&gt;assuming that the user selects the MONTH field and the variable vPreviousMonth gets the date for previous month.&amp;nbsp; o course all this will depend on how you store values in MONTH and your data model&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 14:18:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065327#M87378</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2023-04-27T14:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Measures that calculate KPIs for the previous month.</title>
      <link>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065405#M87389</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;OrderDate = {"&amp;gt;=$(=MonthStart(AddMonths(Max(OrderDate), -1)))&amp;lt;=$(=MonthEnd(AddMonths(Max(OrderDate), -1)))"}&amp;gt;} Total Revenue)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 17:38:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065405#M87389</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2023-04-27T17:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Measures that calculate KPIs for the previous month.</title>
      <link>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065873#M87422</link>
      <description>&lt;P&gt;Thank you for this&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/49432"&gt;@Chanty4u&lt;/a&gt;!&lt;/P&gt;
&lt;P&gt;I have tried to use this in a master measure but get the following error:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krisk_0-1682695101857.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106063iE7B5CB25C65C4FE1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="krisk_0-1682695101857.png" alt="krisk_0-1682695101857.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="krisk_1-1682695116970.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106064iB10C857C5C91C641/image-size/medium?v=v2&amp;amp;px=400" role="button" title="krisk_1-1682695116970.png" alt="krisk_1-1682695116970.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the entire condition meant to be in green like it is a string? or should it have more string breaks in it? (apologies if that is a stupid question, I am still trying to get my head around syntax etc)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 15:20:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065873#M87422</guid>
      <dc:creator>krisk</dc:creator>
      <dc:date>2023-04-28T15:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Measures that calculate KPIs for the previous month.</title>
      <link>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065915#M87436</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you have debug the expression by parts&amp;nbsp;&lt;/P&gt;
&lt;P&gt;=Max(OrderDate)&lt;/P&gt;
&lt;P&gt;=AddMonths(Max(OrderDate), -1)&lt;/P&gt;
&lt;P&gt;=MonthStart(AddMonths(Max(OrderDate), -1))&lt;/P&gt;
&lt;P&gt;=MonthEnd(AddMonths(Max(OrderDate), -1&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And check where is the issue...and check the order date is formatted&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 16:44:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Measures-that-calculate-KPIs-for-the-previous-month/m-p/2065915#M87436</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2023-04-28T16:44:29Z</dc:date>
    </item>
  </channel>
</rss>

