<?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 get previous Month data in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001945#M954858</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If you have a dimension called MonthYear then I'm guessing you've got a master calendar. If you add a MonthID field to the calendar you'll make life easy. If your Calendar is loaded in the usual way, creating dates from the earliest to the latest, then if you add something like this above your master calendar script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;AutoNumber(&lt;SPAN style="font-size: 13.3333px;"&gt;MonthYear &lt;/SPAN&gt;, 'MonthID') as &lt;SPAN style="font-size: 13.3333px;"&gt;MonthID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;LOAD ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll have a nice integer field you can do simple arithmetic on. Now if you select a month an expression with the set modifier &amp;lt;&lt;SPAN style="font-size: 13.3333px;"&gt;MonthID&lt;/SPAN&gt; = {$(=Max(&lt;SPAN style="font-size: 13.3333px;"&gt;MonthID&lt;/SPAN&gt;)-1)}, &lt;SPAN style="font-size: 13.3333px;"&gt;MonthYear &lt;/SPAN&gt;=&amp;gt;} will give the calculation for the previous month. You may need to add other terms to this, such as ... Month =, Year =... so that it will disregard other selections as may be required. Then to tidy it all up you can create a variable to hold your set modifier and if you want add &lt;SPAN style="font-size: 13.3333px;"&gt;a parameter for the number of months you want to look back instead of having 1 hard written then you have a very flexible and easy to read and maintain solution&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Cheers&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Andrew &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 16 Nov 2015 12:20:16 GMT</pubDate>
    <dc:creator>effinty2112</dc:creator>
    <dc:date>2015-11-16T12:20:16Z</dc:date>
    <item>
      <title>How to get previous Month data</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001938#M954851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in my report I have calendar objects for FromDate and ToDate. when I select a date range it is giving the results.&lt;/P&gt;&lt;P&gt;here my issue is if I select a date range in a particular month, will I get both selected month and previous month data in the same report(Line Chart).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example: when I select Date range 01-October-2015 to 31-Oct-2015. it will give the total volume for the October Month, I want to get Previous month September total volume.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dimension: MonthYear(Jan-2015)&lt;/P&gt;&lt;P&gt;Expression: Sum(Amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 10:45:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001938#M954851</guid>
      <dc:creator />
      <dc:date>2015-11-16T10:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get previous Month data</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001939#M954852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;Current-mnth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;&lt;STRONG style="font-size: 10pt;"&gt;=sum({&amp;lt;Date={'$(=Date(Max(Date),'M/D/YYYY'))'}&amp;gt;}Balance)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;&lt;STRONG style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;Previous:mnth&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;&lt;STRONG&gt;=sum({&amp;lt;Date={"$(=Date(Max({1}{&amp;lt;Date={'&amp;lt;$(=Date(Max(Date),'M/D/YYYY'))'}&amp;gt;}Date),'M/D/YYYY'))"}&amp;gt;}Balance)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;&lt;STRONG&gt;hope this helps u&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;&lt;STRONG&gt;thanks&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: helvetica;"&gt;&lt;STRONG&gt;Suresh&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 10:50:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001939#M954852</guid>
      <dc:creator>Chanty4u</dc:creator>
      <dc:date>2015-11-16T10:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get previous Month data</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001940#M954853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this for previous month:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=If(Sum(Amount) &amp;gt; 0, Above(Sum({&amp;lt;Date, MonthYear&amp;gt;}Amount))&lt;SPAN style="color: #ff0000;"&gt;)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 11:09:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001940#M954853</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-16T11:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get previous Month data</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001941#M954854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&amp;lt;Date={"&amp;gt;=Date(addmonths(Monthstart(max(Date),-1)))&amp;lt;=Date(addmonths(max(Date),-1))"}&amp;gt;}Amount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 11:15:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001941#M954854</guid>
      <dc:creator>PrashantSangle</dc:creator>
      <dc:date>2015-11-16T11:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get previous Month data</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001942#M954855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For previous month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=sum({&amp;lt;Date={"&amp;gt;=$(=Date(monthstart(addmonths(max(Date),-1))))&amp;lt;=$(=Date(monthend(addmonths(max(Date),-1))))"}, Year=,Month=, Date=&amp;gt;}Amount)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 11:23:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001942#M954855</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2015-11-16T11:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get previous Month data</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001943#M954856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use MonthStart() and MonthEnd() as suggested by Max/Kush&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 11:41:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001943#M954856</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-16T11:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get previous Month data</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001944#M954857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this what you want?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="105592" alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/105592_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use this dummy script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Date(MakeDate(2015,1,1) + RecNo() - 1) as Date,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; MonthName(MakeDate(2015,1,1) + RecNo() - 1) as MonthYear,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Ceil(Rand() * 100000) as Value&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AutoGenerate (Today() + 1 - MakeDate(2015,1,1));&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 11:51:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001944#M954857</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-11-16T11:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get previous Month data</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001945#M954858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If you have a dimension called MonthYear then I'm guessing you've got a master calendar. If you add a MonthID field to the calendar you'll make life easy. If your Calendar is loaded in the usual way, creating dates from the earliest to the latest, then if you add something like this above your master calendar script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;*,&lt;/P&gt;&lt;P&gt;AutoNumber(&lt;SPAN style="font-size: 13.3333px;"&gt;MonthYear &lt;/SPAN&gt;, 'MonthID') as &lt;SPAN style="font-size: 13.3333px;"&gt;MonthID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;LOAD ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'll have a nice integer field you can do simple arithmetic on. Now if you select a month an expression with the set modifier &amp;lt;&lt;SPAN style="font-size: 13.3333px;"&gt;MonthID&lt;/SPAN&gt; = {$(=Max(&lt;SPAN style="font-size: 13.3333px;"&gt;MonthID&lt;/SPAN&gt;)-1)}, &lt;SPAN style="font-size: 13.3333px;"&gt;MonthYear &lt;/SPAN&gt;=&amp;gt;} will give the calculation for the previous month. You may need to add other terms to this, such as ... Month =, Year =... so that it will disregard other selections as may be required. Then to tidy it all up you can create a variable to hold your set modifier and if you want add &lt;SPAN style="font-size: 13.3333px;"&gt;a parameter for the number of months you want to look back instead of having 1 hard written then you have a very flexible and easy to read and maintain solution&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Cheers&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Andrew &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 12:20:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-get-previous-Month-data/m-p/1001945#M954858</guid>
      <dc:creator>effinty2112</dc:creator>
      <dc:date>2015-11-16T12:20:16Z</dc:date>
    </item>
  </channel>
</rss>

