<?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 Leap year Problem in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167269#M503862</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Swetha,&lt;/P&gt;&lt;P&gt;The only way I know, now I've seen your data, to control that is checking conditionally that on feb 29 2008 and greater until dec 31 2008 you should sum&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Date(AddMonths(Date, -12) + 1)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;otherwise &lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;AddMonths(Date, -12)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;. I don't know any other smarter or clearer solution, unfortunately. &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 Mar 2010 15:18:45 GMT</pubDate>
    <dc:creator>Miguel_Angel_Baeyens</dc:creator>
    <dc:date>2010-03-04T15:18:45Z</dc:date>
    <item>
      <title>Leap year Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167262#M503855</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;I am using the below formulas to calculate previous year and current year sales:&lt;/P&gt;&lt;P&gt;Current_Year:sum({$&amp;lt;Order_Date_Key={"&amp;lt;=$(=(max(Order_Date_Key)))"}, status={"Current"}&amp;gt;} Sold_At*Qty)&lt;/P&gt;&lt;P&gt;Previous_Year:if(year(Order_CALENDAR_DATE)='2008',sum({$&amp;lt;Order_Date_Key={"&amp;lt;=$(=max(Order_Date_Key)-366)"}, status={"Previous"}&amp;gt;} Sold_At*Qty),&lt;BR /&gt;if(date(Order_CALENDAR_DATE,'M/D/YYYY')='2/29/2008','-',sum({$&amp;lt;Order_Date_Key={"&amp;lt;=$(=max(Order_Date_Key)-366)"}, status={"Previous"}&amp;gt;} Sold_At*Qty)))&lt;/P&gt;&lt;P&gt;The above previous year adjustment is done to address when the year is leap year but its not working.Any help would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 15:07:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167262#M503855</guid>
      <dc:creator />
      <dc:date>2010-03-03T15:07:31Z</dc:date>
    </item>
    <item>
      <title>Leap year Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167263#M503856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Swetha,&lt;/P&gt;&lt;P&gt;I'd use (untested)&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;AddMonths(Max(OrderDateKey), -12)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;to generate an actual 12 months backwards expression. You can use it as well in set analysis and use only one expression &lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;sum({$&amp;lt;Order_Date_Key={"&amp;lt;=$(=AddMonths(max(Order_Date_Key), -12))"}, status={"Previous"}&amp;gt;} Sold_At*Qty)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 15:46:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167263#M503856</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-03-03T15:46:41Z</dc:date>
    </item>
    <item>
      <title>Leap year Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167264#M503857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Miguel.&lt;/P&gt;&lt;P&gt;I have tried your options but am unable to acheive the needed.Let me explain my problem clearly.I have 4 columns:&lt;/P&gt;&lt;P&gt;Column1:Curr_Order_Date==date(Order_CALENDAR_DATE) which gives 2/1/2008...........2/29/2008 if I select Feb 2008&lt;/P&gt;&lt;P&gt;column2:sum({$&amp;lt;Order_Date_Key={"&amp;lt;=$(=(max(Order_Date_Key)))"}, status={"Current"}&amp;gt;} Sold_At*Qty) which gives the current year sum of sold_at*qty&lt;/P&gt;&lt;P&gt;Column3:sum({$&amp;lt;Order_Date_Key={"&amp;lt;=$(=max(Order_Date_Key)-365)"}, status={"Previous"}&amp;gt;} Sold_At*Qty) which gives sum of 2007 (as 2007 is previous year for 2008.&lt;/P&gt;&lt;P&gt;Column4: date(Order_CALENDAR_DATE-365,'M/D/YYYY') which gives 2/1/2007 to 3/1/2007 as 2/29/2007 is not there.&lt;/P&gt;&lt;P&gt;I mean whenever a leap year is coming my totals for the previous year are wrong as in a leap year in the month of february there are 29 days so it is substituting 3/1/2007 for 2/29/2008.Hope I am clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The site is not allowing to attach a doc.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Swetha&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 16:37:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167264#M503857</guid>
      <dc:creator />
      <dc:date>2010-03-03T16:37:11Z</dc:date>
    </item>
    <item>
      <title>Leap year Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167265#M503858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Swetha,&lt;/P&gt;&lt;P&gt;I'm afraid I'm missing something. Obviously when comparing to a leap year, you have one day longer your calendar, and it would not be correct to just ignore that day, as it will mislead your reports and graphs.&lt;/P&gt;&lt;P&gt;That's why I told you about AddMonths() function, which returns the number of months you set. I understand that "gap" in leap years, but in my opinion that is what is has to be.&lt;/P&gt;&lt;P&gt;Anyway, if you just want to jump over 2/29/2008 you can do it in your load script with a map of possible leap februaries and their correspondences for previous year. I think I should check your file to address your issue correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 16:48:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167265#M503858</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-03-03T16:48:18Z</dc:date>
    </item>
    <item>
      <title>Leap year Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167266#M503859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Order_date_key column is not a date(its just a number-1234,45678,.....) in my data so addmonth is not working here I think.I am trying to attach the file but the site is not allowing me to do so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Swetha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 17:46:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167266#M503859</guid>
      <dc:creator />
      <dc:date>2010-03-03T17:46:52Z</dc:date>
    </item>
    <item>
      <title>Leap year Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167267#M503860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;[View:http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/5758.Doc1.zip:550:0]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 19:05:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167267#M503860</guid>
      <dc:creator />
      <dc:date>2010-03-03T19:05:48Z</dc:date>
    </item>
    <item>
      <title>Leap year Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167268#M503861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pls find the enclosed doc which I was trying to explain and pls suggest solution if possible.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Swetha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Mar 2010 19:08:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167268#M503861</guid>
      <dc:creator />
      <dc:date>2010-03-03T19:08:42Z</dc:date>
    </item>
    <item>
      <title>Leap year Problem</title>
      <link>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167269#M503862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Swetha,&lt;/P&gt;&lt;P&gt;The only way I know, now I've seen your data, to control that is checking conditionally that on feb 29 2008 and greater until dec 31 2008 you should sum&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;Date(AddMonths(Date, -12) + 1)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;otherwise &lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;AddMonths(Date, -12)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;. I don't know any other smarter or clearer solution, unfortunately. &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Mar 2010 15:18:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Leap-year-Problem/m-p/167269#M503862</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2010-03-04T15:18:45Z</dc:date>
    </item>
  </channel>
</rss>

