<?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: Min and Max Dates in Load Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587142#M443289</link>
    <description>&lt;P&gt;Difficult to say much without more information... I don't really know the data that you have and the output you are getting vs the output you want. From past I know that you are not able to share a sample, unless that has changed, I don't think I will be able to offer much help here.&lt;/P&gt;&lt;P&gt;All the best.&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2019 12:51:57 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-05-31T12:51:57Z</dc:date>
    <item>
      <title>Min and Max Dates in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587081#M443281</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I need to get the min and max dates for each year in my load script.&amp;nbsp; Is there an easy way to do it?&amp;nbsp; Here is a sample of my script.&lt;/P&gt;&lt;P&gt;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;FiscalCalendar_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;WKNO as DWKNO,&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;FROM [D:\Qlikview\New Sales\QVD\ZZZWEDAT DaveyTree v1.0.qvd] (qvd)&lt;BR /&gt;where FISYR &amp;gt;= '$(vPYear)' and FISYR &amp;lt;= '$(vCYear)'&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Left Join FiscalCalendar_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;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;Min(Date_ZWKDATE) as MinDate,&lt;BR /&gt;Max(Date_ZWKDATE) as MaxDate&lt;BR /&gt;Resident FiscalCalendar_TEMP;&lt;/P&gt;&lt;P&gt;Drop Table FiscalCalendar_TEMP;&lt;/P&gt;&lt;P&gt;Exit SCRIPT;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:25:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587081#M443281</guid>
      <dc:creator>tmumaw</dc:creator>
      <dc:date>2024-11-16T03:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Min and Max Dates in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587114#M443283</link>
      <description>&lt;P&gt;Min and max from which table? CurrentDate? What do you want to do with it once you have the min and max date? Store them in a table or variables?&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 11:54:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587114#M443283</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-05-31T11:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Min and Max Dates in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587124#M443285</link>
      <description>&lt;P&gt;I would like to store them in the table.&amp;nbsp; I'm trying to see how many employees I have active on my min date and how many I have active on my max date.&amp;nbsp; Maybe it just a expression.&amp;nbsp; Don't know which way is the best.&amp;nbsp; Be nice to just us a calculation.&amp;nbsp; I have created a calculated dimension which works&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;=&lt;FONT color="#0000ff"&gt;Aggr&lt;/FONT&gt;(&lt;FONT color="#0000ff"&gt;Min&lt;/FONT&gt;(&lt;FONT color="#0000ff"&gt;Date&lt;/FONT&gt;(&lt;FONT color="#800000"&gt;Date_ZWKDATE&lt;/FONT&gt;)),&lt;FONT color="#800000"&gt;DFISYR&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt;)&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;=&lt;FONT color="#0000ff"&gt;Aggr&lt;/FONT&gt;(&lt;FONT color="#0000ff"&gt;Max&lt;/FONT&gt;(&lt;FONT color="#0000ff"&gt;Date&lt;/FONT&gt;(&lt;FONT color="#800000"&gt;Date_ZWKDATE&lt;/FONT&gt;)),&lt;FONT color="#800000"&gt;DFISYR&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt;&lt;FONT size="4"&gt;)&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1"&gt;&lt;FONT size="4"&gt;I would like to just create an expression if possible using this calculation.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;FONT color="#0000ff"&gt;Count&lt;/FONT&gt;( {&amp;lt;&lt;FONT color="#800000"&gt;Reason&lt;/FONT&gt;=,&lt;FONT color="#800000"&gt;Job&lt;/FONT&gt;=,&lt;FONT color="#800000"&gt;[Profit Center]&lt;/FONT&gt;=,&lt;FONT color="#800000"&gt;EmpDays&lt;/FONT&gt; = {1}&amp;gt;} &lt;FONT color="#0000ff"&gt;DISTINCT&lt;/FONT&gt;(&lt;FONT color="#800000"&gt;Date_ZWKDATE&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt;&lt;FONT size="4"&gt;))&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 12:08:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587124#M443285</guid>
      <dc:creator>tmumaw</dc:creator>
      <dc:date>2019-05-31T12:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Min and Max Dates in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587126#M443286</link>
      <description>&lt;P&gt;What exactly are you hoping your expression to do? How is Min and Max date each year linked to your expression? Do you want the distinct count for only min and max dates for each DFISYR?&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 12:11:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587126#M443286</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-05-31T12:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Min and Max Dates in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587139#M443288</link>
      <description>&lt;P&gt;Sonny,&lt;/P&gt;&lt;P&gt;What I am trying to do is get the number of active employees for 2015, 2016, 2017.&amp;nbsp; For each year I need to get&amp;nbsp; starting date and ending date.&amp;nbsp; We work off of a 4/4/5 financial calendar.&amp;nbsp; I need to know the number of employees for the starting date and ending date.&amp;nbsp; Thinking maybe just a calculated expression.&amp;nbsp; Having a problem getting this to work.&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;FONT color="#0000ff"&gt;sum&lt;/FONT&gt;({&amp;lt;&lt;FONT color="#800000"&gt;Reason&lt;/FONT&gt;=,&lt;FONT color="#800000"&gt;Job&lt;/FONT&gt;=,&lt;FONT color="#800000"&gt;[Profit Center]&lt;/FONT&gt;=&amp;gt;}&lt;FONT color="#0000ff"&gt;Aggr&lt;/FONT&gt;(&lt;FONT color="#0000ff"&gt;Min&lt;/FONT&gt;(&lt;FONT color="#0000ff"&gt;Date&lt;/FONT&gt;(&lt;FONT color="#800000"&gt;Date_ZWKDATE&lt;/FONT&gt;)), &lt;FONT color="#800000"&gt;EmpCt_ZEMPCT&lt;/FONT&gt; ,&lt;FONT color="#800000"&gt;DFISYR&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="1"&gt;&lt;FONT size="4"&gt;))&lt;/FONT&gt; &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 12:47:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587139#M443288</guid>
      <dc:creator>tmumaw</dc:creator>
      <dc:date>2019-05-31T12:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Min and Max Dates in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587142#M443289</link>
      <description>&lt;P&gt;Difficult to say much without more information... I don't really know the data that you have and the output you are getting vs the output you want. From past I know that you are not able to share a sample, unless that has changed, I don't think I will be able to offer much help here.&lt;/P&gt;&lt;P&gt;All the best.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 12:51:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587142#M443289</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-05-31T12:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: Min and Max Dates in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587205#M443293</link>
      <description>&lt;P&gt;I can share my date file and script.&amp;nbsp; Here is my script&lt;/P&gt;&lt;P&gt;SET ThousandSep=',';&lt;BR /&gt;SET DecimalSep='.';&lt;BR /&gt;SET MoneyThousandSep=',';&lt;BR /&gt;SET MoneyDecimalSep='.';&lt;BR /&gt;SET MoneyFormat='$#,##0.00;($#,##0.00)';&lt;BR /&gt;SET TimeFormat='h:mm:ss TT';&lt;BR /&gt;SET DateFormat='M/D/YYYY';&lt;BR /&gt;SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';&lt;BR /&gt;SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';&lt;BR /&gt;SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';&lt;/P&gt;&lt;P&gt;LET vToday = today();&lt;BR /&gt;LET vYear = year(vToday) + 1;&lt;BR /&gt;Let vCYear = year(vToday);&lt;BR /&gt;LET vPYear = vYear - 5;&lt;BR /&gt;LET vnumToday = num(today());&lt;BR /&gt;LET vRolling5 = makedate(vCYear - 5, month(vToday), 1); // rolling 5 years&lt;BR /&gt;LET vRolling4 = makedate(vCYear - 4, month(vToday), 1); // rolling 4 years&lt;BR /&gt;LET vRolling3 = makedate(vCYear - 3, month(vToday), 1); // rolling 3 years&lt;BR /&gt;LET vRolling2 = makedate(vCYear - 2, month(vToday), 1); // rolling 2 years&lt;BR /&gt;LET vRolling1 = makedate(vCYear - 1, month(vToday), 1); // rolling 1 years&lt;BR /&gt;LET vPrevToday = makedate(vCYear - 2, month(vToday), 1);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//2015 Start and End dates&lt;/P&gt;&lt;P&gt;//LET vSYear='20150104'; //SAP Format SQL 'YYYYMMDD&lt;BR /&gt;//LET vEYear='20160102'; //SAP Format SQL 'YYYYMMDD'&lt;/P&gt;&lt;P&gt;//2016 Start and End dates&lt;/P&gt;&lt;P&gt;//LET vSYear='20160104'; //SAP Format SQL 'YYYYMMDD&lt;BR /&gt;//LET vEYear='20161231'; //SAP Format SQL 'YYYYMMDD'&lt;/P&gt;&lt;P&gt;//2017 Start and End dates&lt;/P&gt;&lt;P&gt;//LET vSYear='20170101'; //SAP Format SQL 'YYYYMMDD&lt;BR /&gt;//LET vEYear='20171230'; //SAP Format SQL 'YYYYMMDD'&lt;/P&gt;&lt;P&gt;//2018 Start and End dates&lt;/P&gt;&lt;P&gt;//LET vSYear='20171231'; //SAP Format SQL 'YYYYMMDD&lt;BR /&gt;//LET vEYear='20181229'; //SAP Format SQL 'YYYYMMDD'&lt;/P&gt;&lt;P&gt;//2019 Start and End dates&lt;/P&gt;&lt;P&gt;//LET vSYear='20181230'; //SAP Format SQL 'YYYYMMDD&lt;BR /&gt;//LET vEYear='20191228'; //SAP Format SQL 'YYYYMMDD'&lt;/P&gt;&lt;P&gt;&lt;BR /&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;FiscalCalendar_TEMP:&lt;BR /&gt;LOAD Distinct&lt;BR /&gt;FISYR as DFISYR,&lt;BR /&gt;FISPD as DFISPD,&lt;BR /&gt;WKNO as DWKNO,&lt;BR /&gt;WEDAT as DWEDAT,&lt;BR /&gt;num(WEDAT, '####0') as WEDAT_Num,&lt;BR /&gt;num([Billing Date], '####0') as BillingDateNum,&lt;BR /&gt;WeekDay([Billing Date]) as Weekday,&lt;BR /&gt;[Billing Date] as Date_ZWKDATE,&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;FROM [D:\Qlikview\New Sales\QVD\ZZZWEDAT DaveyTree v1.0.qvd] (qvd)&lt;BR /&gt;where FISYR &amp;gt;= '$(vPYear)' and FISYR &amp;lt;= '$(vCYear)'&lt;BR /&gt;;&lt;BR /&gt;exit SCRIPT;&lt;BR /&gt;Left Join FiscalCalendar_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;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;Min(BillingDateNum) as MinDate,&lt;BR /&gt;Max(BillingDateNum) as MaxDate&lt;BR /&gt;Resident FiscalCalendar_TEMP;&lt;/P&gt;&lt;P&gt;Drop Table FiscalCalendar_TEMP;&lt;/P&gt;&lt;P&gt;Exit SCRIPT;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 15:17:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587205#M443293</guid>
      <dc:creator>tmumaw</dc:creator>
      <dc:date>2019-05-31T15:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Min and Max Dates in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587207#M443294</link>
      <description>&lt;P&gt;Forgot to attach the data&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 15:20:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Min-and-Max-Dates-in-Load-Script/m-p/1587207#M443294</guid>
      <dc:creator>tmumaw</dc:creator>
      <dc:date>2019-05-31T15:20:43Z</dc:date>
    </item>
  </channel>
</rss>

