<?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: Same day previous years in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Same-day-previous-years/m-p/1591278#M443582</link>
    <description>Try using the AddYears function&lt;BR /&gt;This function returns the date occurring n years after startdate or, if n is negative, the date occurring n years before startdate.&lt;BR /&gt;&lt;BR /&gt;addyears(startdate, n)&lt;BR /&gt;so for your case ..&lt;BR /&gt;Let vLYday = addyears('$(vToday)', -1);</description>
    <pubDate>Wed, 12 Jun 2019 23:32:54 GMT</pubDate>
    <dc:creator>Lisa_P</dc:creator>
    <dc:date>2019-06-12T23:32:54Z</dc:date>
    <item>
      <title>Same day previous years</title>
      <link>https://community.qlik.com/t5/QlikView/Same-day-previous-years/m-p/1591095#M443567</link>
      <description>&lt;P&gt;I need a little help in setting some flags in my script.&amp;nbsp; I set a variable so I know what today's date is, but I need to get the same day previous year.&amp;nbsp; I have 5 years in my calendar.&amp;nbsp; Here is my script if anyone can help thanks.&lt;/P&gt;&lt;P&gt;CurrentDate:&lt;BR /&gt;LOAD FISPD,&lt;BR /&gt;FISYR,&lt;BR /&gt;[Billing Date] as Date,&lt;BR /&gt;WEDAT,&lt;BR /&gt;WKNO&lt;BR /&gt;FROM [D:\Qlikview\New Sales\QVD\ZZZWEDAT DaveyTree v1.0.qvd] (qvd)&lt;BR /&gt;where [Billing Date] = '$(vToday)';&lt;/P&gt;&lt;P&gt;LET vFisYr = peek('FISYR', 0, 'CurrentDate');&lt;BR /&gt;LET vFisPd = peek('FISPD', 0, 'CurrentDate');&lt;BR /&gt;LET vWkNo = peek('WKNO', 0, 'CurrentDate');&lt;/P&gt;&lt;P&gt;DROP TABLE CurrentDate;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Temp:&lt;BR /&gt;LOAD Distinct&lt;BR /&gt;FISPD as DFISPD,&lt;BR /&gt;FISYR as DFISYR,&lt;BR /&gt;[Billing Date] as Date_ZWKDATE,&lt;BR /&gt;WEDAT as DWEDAT,&lt;BR /&gt;num(WEDAT, '####0') as WEDAT_Num,&lt;BR /&gt;num(Date(Floor([Billing Date]))) as Num_Date_ZWKDATE,&lt;BR /&gt;WKNO as DWKNO,&lt;BR /&gt;num([Billing Date], '####0') as BillingDateNum,&lt;BR /&gt;WeekDay([Billing Date]) as Weekday,&lt;BR /&gt;if([Billing Date] &amp;lt;= '$(vToday)' AND FISPD &amp;lt;= '$(vFisPd)' AND WKNO &amp;lt;= '$(vWkNo)', 1) AS YTDFlag,&lt;BR /&gt;if([Billing Date] &amp;lt;= '$(vToday)' AND FISPD = '$(vFisPd)', 1) AS MTDFlag,&lt;BR /&gt;if([Billing Date] &amp;lt;= '$(vToday)' AND FISPD = '$(vFisPd)' AND WKNO = '$(vWkNo)', 1) AS WTDFlag,&lt;BR /&gt;if([Billing Date] &amp;lt;= '$(vPrevToday)' AND [Billing Date] &amp;gt;= '$(vRolling4)', 1) AS RTD4Flag,&lt;BR /&gt;if([Billing Date] &amp;lt;= '$(vToday)' AND [Billing Date] &amp;gt;= '$(vRolling3)', 1) AS RTD3Flag,&lt;BR /&gt;if([Billing Date] &amp;lt;= '$(vToday)' AND [Billing Date] &amp;gt;= '$(vRolling2)', 1) AS RTD2Flag,&lt;BR /&gt;if([Billing Date] &amp;lt;= '$(vToday)' AND [Billing Date] &amp;gt;= '$(vRolling1)', 1) AS RTD1Flag,&lt;BR /&gt;autonumber(RowNo(), FISYR) as DayCount&lt;BR /&gt;FROM [D:\Qlikview\New Sales\QVD\ZZZWEDAT DaveyTree v1.0.qvd] (qvd)&lt;BR /&gt;where FISYR &amp;gt;= '$(vPYear)' and [Billing Date] &amp;lt;= '$(vToday)'&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Temp1:&lt;BR /&gt;Load&lt;BR /&gt;DFISYR,&lt;BR /&gt;if(DFISYR &amp;gt;= '$(vPYear)' and DFISYR &amp;lt;= '$(vCYear)' and (DayCount = '1'),Date_ZWKDATE) as StartDate&lt;BR /&gt;Resident Temp&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Left Join (Temp1)&lt;BR /&gt;Load&lt;BR /&gt;DFISYR,&lt;BR /&gt;if(DFISYR &amp;gt;= '$(vPYear)' and DFISYR &amp;lt; '$(vCYear)' and (DayCount &amp;gt;= '364'),Date_ZWKDATE,&lt;BR /&gt;if(DFISYR = '$(vCYear)' and Date_ZWKDATE = '$(vToday)',Date_ZWKDATE)) as EndDate&lt;BR /&gt;Resident Temp&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;Left Join (Temp)&lt;BR /&gt;LOAD DFISYR,&lt;BR /&gt;Date(Only(StartDate)) as SDate,&lt;BR /&gt;Date(Only(EndDate)) as EDate&lt;BR /&gt;Resident Temp1&lt;BR /&gt;Group By DFISYR;&lt;BR /&gt;Drop table Temp1&lt;BR /&gt;;&lt;BR /&gt;Left Join (Temp)&lt;BR /&gt;LOAD * INLINE [DFISPD, DQTR, DMTH&lt;BR /&gt;001, Q1, Jan,&lt;BR /&gt;002, Q1, Feb,&lt;BR /&gt;003, Q1, Mar,&lt;BR /&gt;004, Q2, Apr,&lt;BR /&gt;005, Q2, May,&lt;BR /&gt;006, Q2, Jun,&lt;BR /&gt;007, Q3, Jul,&lt;BR /&gt;008, Q3, Aug,&lt;BR /&gt;009, Q3, Sep,&lt;BR /&gt;010, Q4, Oct,&lt;BR /&gt;011, Q4, Nov,&lt;BR /&gt;012, Q4, Dec&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;Temp2:&lt;BR /&gt;Load *,&lt;BR /&gt;if(DFISYR &amp;gt;= '$(vPYear)' and DFISYR &amp;lt;= '$(vCYear)' and (DayCount = '1'),1,0) as StartFlag,&lt;BR /&gt;if(DFISYR &amp;gt;= '$(vPYear)' and DFISYR &amp;lt; '$(vCYear)' and (DayCount &amp;gt;= '364'),1,&lt;BR /&gt;if(DFISYR = '$(vCYear)' and Date_ZWKDATE = '$(vToday)' - 1,1,0)) as EndFlag,&lt;BR /&gt;if(DFISYR = '$(vPYear)',5,&lt;BR /&gt;if(DFISYR = '$(vPYear)' + 1,4,&lt;BR /&gt;if(DFISYR = '$(vPYear)' + 2,3,&lt;BR /&gt;if(DFISYR = '$(vPYear)' + 3,2,&lt;BR /&gt;if(DFISYR = '$(vPYear)' + 4,1,0))))) as NewHireSFlag&lt;BR /&gt;Resident Temp&lt;BR /&gt;;&lt;BR /&gt;DROP Table Temp&lt;BR /&gt;;&lt;BR /&gt;FiscalCalendar:&lt;BR /&gt;LOAD *,&lt;BR /&gt;DFISYR &amp;amp; ' / ' &amp;amp; DQTR as DQYR,&lt;BR /&gt;DQTR &amp;amp; ' / ' &amp;amp; DFISYR as DYRQ,&lt;BR /&gt;DFISYR &amp;amp; ' / ' &amp;amp; DFISPD as DFYPD,&lt;BR /&gt;Right(DFISYR,2) &amp;amp; '-' &amp;amp; DMTH as DYRMTH&lt;BR /&gt;Resident Temp2;&lt;/P&gt;&lt;P&gt;Drop Table Temp2;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:19:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Same-day-previous-years/m-p/1591095#M443567</guid>
      <dc:creator>tmumaw</dc:creator>
      <dc:date>2024-11-16T03:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Same day previous years</title>
      <link>https://community.qlik.com/t5/QlikView/Same-day-previous-years/m-p/1591278#M443582</link>
      <description>Try using the AddYears function&lt;BR /&gt;This function returns the date occurring n years after startdate or, if n is negative, the date occurring n years before startdate.&lt;BR /&gt;&lt;BR /&gt;addyears(startdate, n)&lt;BR /&gt;so for your case ..&lt;BR /&gt;Let vLYday = addyears('$(vToday)', -1);</description>
      <pubDate>Wed, 12 Jun 2019 23:32:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Same-day-previous-years/m-p/1591278#M443582</guid>
      <dc:creator>Lisa_P</dc:creator>
      <dc:date>2019-06-12T23:32:54Z</dc:date>
    </item>
  </channel>
</rss>

