<?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: Load data from min and max date. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520414#M480313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Min() and the Max() functions pick out the smallest and largest value. These are then assigned to the variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I create the Master Calendar/Date dimension using an Autogenerate instead of loading from a table - but both ways work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your date has the format YYYYMMDD, you need to load it using an interpretation function, otherwise none of the Date/Time-functions work. Hence:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date#(DateKey,'YYYYMMDD') as DateKey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Dec 2013 20:55:42 GMT</pubDate>
    <dc:creator>hic</dc:creator>
    <dc:date>2013-12-03T20:55:42Z</dc:date>
    <item>
      <title>Load data from min and max date.</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520410#M480309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a DimensionDate with dates from 1900 to 2018. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My fact contains data from 2007-01-01 to today 2013-03-12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would you then do so i dont load all dates from my dimension (my listbox will show to many dates or years and so on)&lt;/P&gt;&lt;P&gt;(I could do this in SQL where i select a hardcoded date, but i rather want to peek down into my fact table )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets say i have this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FactSales:&lt;/P&gt;&lt;P&gt;Amount&lt;/P&gt;&lt;P&gt;DateKey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vMinLoadDate = peek(FactSales,'DateKey',0)&lt;/P&gt;&lt;P&gt;Let vMaxLoadDate = peek(FactSales,'DateKey,1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DimDate:&lt;/P&gt;&lt;P&gt;DateKey (YYYYMMDD)&lt;/P&gt;&lt;P&gt;Date_Clean (YYYY-MM-DD)&lt;/P&gt;&lt;P&gt;and so on&lt;/P&gt;&lt;P&gt;from xxxxx&lt;/P&gt;&lt;P&gt;where DateKey between '($vMinLoadDate)' and '($vMaxLoadDate)'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am i able to do so? or how would you do it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 16:06:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520410#M480309</guid>
      <dc:creator />
      <dc:date>2013-12-03T16:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Load data from min and max date.</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520411#M480310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind i answered my own question. Sorry for that &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vMinLoadDate = num(peek('DateKey', 0, 'FactInternetsales'));&lt;/P&gt;&lt;P&gt;Let vMaxLoadDate = num(peek('DateKey', -1, 'FactInternetsales'));&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 16:16:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520411#M480310</guid>
      <dc:creator />
      <dc:date>2013-12-03T16:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: Load data from min and max date.</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520412#M480311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If your Fact table is sorted, then your solution will work. If not, you can use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MinMaxDate:&lt;/P&gt;&lt;P&gt;Load Min(Date) as MinDate, Max(Date) as MaxDate resident &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12.727272033691406px;"&gt;FactInternetsales&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;Let vMinDate = Peek('MinDate',-1,'MinMaxDate') - 1;&lt;/P&gt;&lt;P&gt;Let vMaxDate = Peek('MaxDate',-1,'MinMaxDate')&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;Load Date(recno()+$(vMinDate)) as Date Autogenerate vMaxDate - vMinDate;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 16:18:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520412#M480311</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-12-03T16:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: Load data from min and max date.</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520413#M480312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;okay - can you explain what the two function does? and why you do so? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What if i have a DateDimension AND a master calendar?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My mastercalender i use example date_Clean but datekey is the surrogate key. (YYYYMMDD)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 19:27:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520413#M480312</guid>
      <dc:creator />
      <dc:date>2013-12-03T19:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Load data from min and max date.</title>
      <link>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520414#M480313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Min() and the Max() functions pick out the smallest and largest value. These are then assigned to the variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I create the Master Calendar/Date dimension using an Autogenerate instead of loading from a table - but both ways work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your date has the format YYYYMMDD, you need to load it using an interpretation function, otherwise none of the Date/Time-functions work. Hence:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date#(DateKey,'YYYYMMDD') as DateKey&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Dec 2013 20:55:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-data-from-min-and-max-date/m-p/520414#M480313</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2013-12-03T20:55:42Z</dc:date>
    </item>
  </channel>
</rss>

