<?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: Set Analysis Current Month vs Previous Month in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950137#M467730</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jamie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take note that when you do this you need to consider the year as well so you basically need to something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;&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;Style=&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;,&lt;/SPAN&gt;Year = {$(=Year(addmonths(max(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;GasDay&lt;/SPAN&gt;),-1)))},&lt;/P&gt;&lt;P&gt;,Month= {$(=(num(month(addmonths(max(date($(=Max(&lt;SPAN style="font-size: 13.3333px;"&gt;Year&lt;/SPAN&gt;)) &amp;amp; '-' &amp;amp; num($(=max(num(&lt;SPAN style="font-size: 13.3333px;"&gt;Month&lt;/SPAN&gt;))),'00') &amp;amp; '-' &amp;amp; '01', 'YYYY-MM-DD')),-1)))))}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt;} &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Charge&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solution provide you what you need &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Oct 2015 09:08:56 GMT</pubDate>
    <dc:creator>miguelbraga</dc:creator>
    <dc:date>2015-10-23T09:08:56Z</dc:date>
    <item>
      <title>Set Analysis Current Month vs Previous Month</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950134#M467727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm having a little bit of trouble getting the result I need having had a look at some similar examples.&amp;nbsp; I am trying to produce a table that shows the aggregate charges for the current month, and then show what the previous month was.&amp;nbsp; I have some list boxes with years and months in them to enable me to change which month I'm looking at.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my table, Current Month is just&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;Style=&amp;gt;}Charge)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Master Calendar is&lt;/P&gt;&lt;P&gt;MasterCalendar:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; TempDate AS LocalTime,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date(Floor(TempDate)) as LocalDay,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Hour(TempDate) AS LocalHour,&lt;/P&gt;&lt;P&gt;&amp;nbsp; GasDay,&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(Hour(TempDate)&amp;lt;=6,Hour(TempDate)+18, Hour(TempDate)-6) AS GasHour,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Week(GasDay) AS Week,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Year(GasDay) AS Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Month(GasDay) AS Month,&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp; num(year(GasDay))*100+num(Month(GasDay)) As year_month_num,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Day(GasDay) AS Day,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Weekday(GasDay) AS WeekDay,&lt;/P&gt;&lt;P&gt;&amp;nbsp; DayNumberOfYear(GasDay) As DayofYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Day(GasDay) &amp;amp; ' ' &amp;amp; Month(GasDay) as DayMonth,&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'Q' &amp;amp; ceil(month(GasDay) / 3) AS Quarter,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date(monthstart(GasDay), 'MMM-YYYY') AS MonthYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp; Week(GasDay)&amp;amp;'-'&amp;amp;Year(GasDay) AS WeekYear,&lt;/P&gt;&lt;P&gt;&amp;nbsp; inyeartodate(GasDay, $(vToday), 0) * -1 AS CurYTDFlag,&lt;/P&gt;&lt;P&gt;&amp;nbsp; inyeartodate(GasDay, $(vToday), -1) * -1 AS LastYTDFlag&lt;/P&gt;&lt;P&gt;RESIDENT TempCal2&lt;/P&gt;&lt;P&gt;ORDER BY TempDate ASC;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added the year_month_num as other examples seemed to indicate this was a good way of doing the month comparison.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my Previous Month, I thought this would work, but it just returns the same result (I'm not even sure why it does that)&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;Style=, year_month_num={"=$(=year_month_num-1)"}&amp;gt;}Charge)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I dont think the year_month_num will work when we select January, as this would be 201501 for instance, and 1 less than that is 201500 not 201412.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2015 00:54:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950134#M467727</guid>
      <dc:creator>jlcoombs</dc:creator>
      <dc:date>2015-10-23T00:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Current Month vs Previous Month</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950135#M467728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use this to create a number field that you can use to calculate the previous month:&lt;/P&gt;&lt;P&gt;num(year(GasDay))*12+num(Month(GasDay)) As year_month_num&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or try &lt;EM&gt;MonthStart(GasDay) as GasMonth&lt;/EM&gt; and use as expression &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;=sum({$&amp;lt;Style=,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;GasMonth&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; line-height: 1.5em;"&gt;={"=$(MonthStart(max(GasMonth),-1))"}&amp;gt;}Charge)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2015 05:40:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950135#M467728</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2015-10-23T05:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Current Month vs Previous Month</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950136#M467729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I did some more searching after I posted this and have determined a solution.&amp;nbsp; I used this page as a reference and adapted to suit my scenario&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-4313"&gt;QlikView App: Set Analysis - Prior Period Comparison&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First I added to my load script the following&lt;/P&gt;&lt;P&gt;let vPriorMonth&amp;nbsp; = '=month(addmonths(max(GasDay),-1))';&lt;/P&gt;&lt;P&gt;let vPriorMonthYear = '=Year(addmonths(max(GasDay),-1))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I used this for finding the last month charges&lt;/P&gt;&lt;P&gt;=SUM({&amp;lt;Year={'$(vPriorMonthYear)'},Month={'$(vPriorMonth)'}&amp;gt;}Charge)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm sure I could have done it without using the variables but that is the bit that trips me up most easily so as long as it works that suits me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2015 05:41:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950136#M467729</guid>
      <dc:creator>jlcoombs</dc:creator>
      <dc:date>2015-10-23T05:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Current Month vs Previous Month</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950137#M467730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jamie,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take note that when you do this you need to consider the year as well so you basically need to something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum({$&amp;lt;&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;Style=&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;,&lt;/SPAN&gt;Year = {$(=Year(addmonths(max(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;GasDay&lt;/SPAN&gt;),-1)))},&lt;/P&gt;&lt;P&gt;,Month= {$(=(num(month(addmonths(max(date($(=Max(&lt;SPAN style="font-size: 13.3333px;"&gt;Year&lt;/SPAN&gt;)) &amp;amp; '-' &amp;amp; num($(=max(num(&lt;SPAN style="font-size: 13.3333px;"&gt;Month&lt;/SPAN&gt;))),'00') &amp;amp; '-' &amp;amp; '01', 'YYYY-MM-DD')),-1)))))}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;gt;} &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Charge&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solution provide you what you need &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Oct 2015 09:08:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950137#M467730</guid>
      <dc:creator>miguelbraga</dc:creator>
      <dc:date>2015-10-23T09:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Current Month vs Previous Month</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950138#M467731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jamie Coombs, i'm struggling with this part since the last 1 week&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Requirement is actually this if a user selects the current month the higest 2 values in current month &lt;/P&gt;&lt;P&gt;and i want to see how these higest values are in previous 3 months user can select any month,&lt;BR /&gt;if he selects any month the previous 3 months data should appear. please help me out&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;LOAD * INLINE [&lt;/P&gt;&lt;P&gt;&amp;nbsp; Country, MonthYear, Value&lt;/P&gt;&lt;P&gt;&amp;nbsp; Argentina,Jun2016,550&lt;/P&gt;&lt;P&gt;&amp;nbsp; Japan,Jun2016,200&lt;/P&gt;&lt;P&gt;&amp;nbsp; America,Jun2016,100&lt;/P&gt;&lt;P&gt;&amp;nbsp; America,May2016,300&lt;/P&gt;&lt;P&gt;&amp;nbsp; Argentina,May2016,250&lt;/P&gt;&lt;P&gt;&amp;nbsp; Japan,May2016,150&lt;/P&gt;&lt;P&gt;&amp;nbsp; America,Apr2016,200&lt;/P&gt;&lt;P&gt;&amp;nbsp; Argentina,Apr2016,170&lt;/P&gt;&lt;P&gt;&amp;nbsp; Japan,Apr2016,210&lt;/P&gt;&lt;P&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My output is below&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/140105_pastedImage_2.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Oct 2016 16:52:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950138#M467731</guid>
      <dc:creator />
      <dc:date>2016-10-09T16:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Current Month vs Previous Month</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950139#M467732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Hi,&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;The easiest solution to this would be to the monthAgo calculation in the Qlik Calender.&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;create an auto calendar for the date field you are trying to visualize by using the Derive fields function in the calendar script. (&amp;nbsp; I can attach the complete auto calendar script if needed)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;ex:-&amp;nbsp; DERIVE FIELDS FROM FIELDS [date Field]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;now, for current month the code in the measure field would be :&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Sum( {$ &amp;lt; [Date.autoCalendar.MonthsAgo] = {'0'}&amp;gt;} sales) &lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;U can change the 0 to 1,2,3 to go back to n last months.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jan 2018 23:01:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950139#M467732</guid>
      <dc:creator>vatsalajmera5</dc:creator>
      <dc:date>2018-01-24T23:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Set Analysis Current Month vs Previous Month</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950140#M467733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vatsal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your auto calendar sounds usefule. I'm new to qlikview, and struggling with scripting correctly to get the periods I want to aggregate for (there seem to be so many solutions!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2018 09:26:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Analysis-Current-Month-vs-Previous-Month/m-p/950140#M467733</guid>
      <dc:creator>zakpullen</dc:creator>
      <dc:date>2018-05-24T09:26:23Z</dc:date>
    </item>
  </channel>
</rss>

