<?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: Using Set Analysis to get Previous Month info in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934264#M981523</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bimala&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this: inset " " before and after calculation string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Inv_YearMonth_Num = { " $(=Max(Date(Date#(max(Inv_YearMonth_Num),'YYYYMM')-1,'YYYYMM'))) " }&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;InvYear = { " $(=max(InvYear) - $(=if(max(InvMonth) = 1, 1, 0))) " }, InvMonth = { " $(=month(addmonths(max(Inv_YearMonth), -1))) " }&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Aug 2015 07:59:30 GMT</pubDate>
    <dc:creator>teiswamsler</dc:creator>
    <dc:date>2015-08-17T07:59:30Z</dc:date>
    <item>
      <title>Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934261#M981520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Experts:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By using Set Analysis I am trying to retrieve the Previous Month Sales Data. It is Dynamic, so based on user selection, it will find out the Current Month and Previous Month and display the Sales information&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g. year Select 2015 , Month = 1, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It should show me the Value Jan-2015 Data and Dec-2014 sales data &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly if&amp;nbsp; &lt;SPAN style="font-size: 13.3333330154419px;"&gt;year Select 2015 , Month = 2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;It should show me the Value Feb-2015 Data and Jan-2015 sales data &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;To my understanding both the below expression should work&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Inv_YearMonth_Num = {$(=Max(Date(Date#(max(Inv_YearMonth_Num),'YYYYMM')-1,'YYYYMM')))}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;InvYear = {$(=max(InvYear) - $(=if(max(InvMonth) = 1, 1, 0)))}, InvMonth = {$(=month(addmonths(max(Inv_YearMonth), -1)))}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Below are my Date and Month related field&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="397"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD class="xl65" height="17" width="107"&gt;InvYear&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="105"&gt;Inv_YearMonth&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="126"&gt;Inv_YearMonth_Num&lt;/TD&gt;&lt;TD class="xl65" style="border-left: none;" width="59"&gt;InvMonth&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="17" style="border-top: none;"&gt;2015&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Feb-2015&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;201502&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Feb&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD align="right" class="xl66" height="17" style="border-top: none;"&gt;2015&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Jan-2015&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;201501&lt;/TD&gt;&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;Jan&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Can anyone throw some light on this issue. The above expression evaluates to 0, which implies, it is not able to get the matching information.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Appreciate an immediate reply.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Kind Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;Bimala&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 07:47:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934261#M981520</guid>
      <dc:creator>bimala0507</dc:creator>
      <dc:date>2015-08-17T07:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934262#M981521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this:&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;&lt;STRONG&gt;=Sum({$&amp;lt;Inv_YearMonth_Num = {"$(=Date(Date#(Max(Inv_YearMonth_Num),'YYYYMM')-1,'YYYYMM'))"}, &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;InvMonth = , &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Inv_YearMonth = , &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;InvYear = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;gt;} Sales)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above expression should show you the sales for 201501 when 201502 is selected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 07:58:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934262#M981521</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-08-17T07:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934263#M981522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi &lt;/P&gt;&lt;P&gt;from my experience the best way to do previous months calculation&lt;/P&gt;&lt;P&gt;is to add to the calendar a monthstart field that conatians for each date the month first date&lt;/P&gt;&lt;P&gt;then your expressions will look like this &lt;/P&gt;&lt;P&gt;sum({&amp;lt;monthstart={"$(=max(monthstart))"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;and for pervious month&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;sum({&amp;lt;monthstart={"$(=addmonths(max(monthstart),-1))"},Inv_year=,Inv_Month=&amp;gt;} Sales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;the advantage of using addmonths function that it works between years automatically&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 07:59:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934263#M981522</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2015-08-17T07:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934264#M981523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bimala&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this: inset " " before and after calculation string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Inv_YearMonth_Num = { " $(=Max(Date(Date#(max(Inv_YearMonth_Num),'YYYYMM')-1,'YYYYMM'))) " }&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;InvYear = { " $(=max(InvYear) - $(=if(max(InvMonth) = 1, 1, 0))) " }, InvMonth = { " $(=month(addmonths(max(Inv_YearMonth), -1))) " }&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 07:59:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934264#M981523</guid>
      <dc:creator>teiswamsler</dc:creator>
      <dc:date>2015-08-17T07:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934265#M981524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Please use the below expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sum({&amp;lt;Year=, Quarter=, &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Inv_YearMonth&lt;/SPAN&gt;={'&amp;gt;=$(=max(Inv_YearMonth_Num)-1&amp;lt;=$(=max(Inv_YearMonth_Num))'}&amp;gt;}&amp;nbsp; Sales)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 08:01:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934265#M981524</guid>
      <dc:creator>qlikviewwizard</dc:creator>
      <dc:date>2015-08-17T08:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934266#M981525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sum({$&amp;lt;Inv_YearMonth_Num = {"$(=Date(addmonths(Date#(max(Inv_YearMonth_Num),'YYYYMM'),-1),'YYYYMM'))"}&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 08:09:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934266#M981525</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2015-08-17T08:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934267#M981526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Inv_YearMonth_Num = {"$(=Date(Max(Date#(Inv_YearMonth_Num,'YYYYMM')) - 1, 'YYYYMM'))"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;Inv_YearMonth_Num = {"$(=Date(AddMonths(Max(Date#(Inv_YearMonth_Num,'YYYYMM')) - 1, -1), 'YYYYMM'))"}&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 08:12:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934267#M981526</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-08-17T08:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934268#M981527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But it is much simpler if you create a proper QV date field when loading:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Inv_YearMonth,&lt;/SPAN&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date(Date#(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Inv_YearMonth, 'MMM-YYYY')) As YMDate,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expressions then are:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;YMDate = {"$(=Date(Max(YMDate) - 1))"}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;sum({$&amp;lt;YMDate = {"$(=AddMonths(Max(YMDate) - 1, -1))"}&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 08:18:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934268#M981527</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-08-17T08:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934269#M981528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much for&amp;nbsp; the insight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed the original expression to below and it worked fine. I had to change to 1 instead of $ and put "". the below expression works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum({&lt;STRONG&gt;1&lt;/STRONG&gt;&amp;lt;Inv_YearMonth_Num = {"$(=Date(Date#(max(Inv_YearMonth_Num),'YYYYMM')-1,'YYYYMM'))"}&amp;gt;} Sales)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2015 08:59:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/934269#M981528</guid>
      <dc:creator>bimala0507</dc:creator>
      <dc:date>2015-08-17T08:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using Set Analysis to get Previous Month info</title>
      <link>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/1525310#M981529</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I need to calculate sum(sales) - sum(sales) of prev month for 6 months in pivot table. Expression to calculate previous month, contains max() .due to which the max month is always selected. I want to get sum(sales) for previous months without using max(). Can u help me for this?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jan 2019 09:18:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-Set-Analysis-to-get-Previous-Month-info/m-p/1525310#M981529</guid>
      <dc:creator>Prink</dc:creator>
      <dc:date>2019-01-02T09:18:07Z</dc:date>
    </item>
  </channel>
</rss>

