<?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 DISTINCT and Preceding Loads in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392199#M698308</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much &lt;STRONG&gt;swuehl &lt;/STRONG&gt;and &lt;STRONG&gt;Juan&lt;/STRONG&gt;.&amp;nbsp; Yes, I recognized that it required as much, but it just didn't seem right to me, so I wanted to be sure I wasn't missing something.&amp;nbsp; Seems a DISTINCT load, even if a preceding load, should be ... well ... &lt;STRONG&gt;&lt;EM&gt;distinct&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp; &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Feb 2013 13:05:54 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-02-01T13:05:54Z</dc:date>
    <item>
      <title>LOAD DISTINCT and Preceding Loads</title>
      <link>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392196#M698305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems that when LOAD DISTINCT is used in a preceding load statement, the subsequent load (above) sees all records, not just the distinct result set.&amp;nbsp; Do I misunderstand or am I missing something?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, consider a very simple Caledar table like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13596909534492536" jivemacro_uid="_13596909534492536"&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1359690967772935" jivemacro_uid="_1359690967772935"&gt;&lt;P&gt;LET vMinDate = Num(MakeDate(2012,01,01));&lt;BR /&gt;LET vMaxDate = Num(MakeDate(2012,01,31));&lt;BR /&gt; &lt;/P&gt;&lt;P&gt;Calendar:&lt;BR /&gt;LOAD &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;DISTINCT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Year(Temp_Date) As Year,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Month(Temp_Date) As Month,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Year(Temp_Date) * 100 + Month(Temp_Date) As [Period]&lt;BR /&gt;; &lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt;&amp;nbsp;&amp;nbsp; MonthStart($(vMinDate) + IterNo() - 1) As Temp_Date&lt;BR /&gt;AUTOGENERATE (1)&lt;BR /&gt;WHILE $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/P&gt;&lt;/PRE&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the LOAD DISTINCT at the bottom indeed results in just one date (Jan 1, 2012) despite that it iterated through 31 days to get that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I do not also include the DISTINCT predicate in the load on the top (&lt;SPAN style="color: #ff0000;"&gt;highligted&lt;/SPAN&gt;), I'll get 31 records in the calendar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this just something obvious that I've missed?&amp;nbsp; Seems once I LOAD DISTINCT, that resultset in the preceding load should be just the distinct records.&amp;nbsp; After all, if I were to create the first load, then load RESIDENT from that, I would not need to use DISTINCT for the second load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thoughts?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2013 04:02:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392196#M698305</guid>
      <dc:creator />
      <dc:date>2013-02-01T04:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: LOAD DISTINCT and Preceding Loads</title>
      <link>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392197#M698306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems like the DISTINCT is done on the last LOAD, so my recomendation is you remove the inner DISTINCT, and you will get what you want:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vMinDate = Num(MakeDate(2012,01,01));&lt;/P&gt;&lt;P&gt;LET vMaxDate = Num(MakeDate(2012,01,31));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Calendar:&lt;/P&gt;&lt;P&gt;LOAD DISTINCT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Year(Temp_Date) As Year,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Month(Temp_Date) As Month,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Year(Temp_Date) * 100 + Month(Temp_Date) As [Period]&lt;/P&gt;&lt;P&gt;; &lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; MonthStart($(vMinDate) + IterNo() - 1) As Temp_Date&lt;/P&gt;&lt;P&gt;AUTOGENERATE (1)&lt;/P&gt;&lt;P&gt;WHILE $(vMinDate) + IterNo() - 1 &amp;lt;= $(vMaxDate);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2013 09:04:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392197#M698306</guid>
      <dc:creator />
      <dc:date>2013-02-01T09:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: LOAD DISTINCT and Preceding Loads</title>
      <link>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392198#M698307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I think that's what Henric also mentioned here:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="loading" href="https://community.qlik.com/message/288799#288799" title="http://community.qlik.com/message/288799#288799"&gt;http://community.qlik.com/message/288799#288799&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2013 10:39:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392198#M698307</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-02-01T10:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: LOAD DISTINCT and Preceding Loads</title>
      <link>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392199#M698308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much &lt;STRONG&gt;swuehl &lt;/STRONG&gt;and &lt;STRONG&gt;Juan&lt;/STRONG&gt;.&amp;nbsp; Yes, I recognized that it required as much, but it just didn't seem right to me, so I wanted to be sure I wasn't missing something.&amp;nbsp; Seems a DISTINCT load, even if a preceding load, should be ... well ... &lt;STRONG&gt;&lt;EM&gt;distinct&lt;/EM&gt;&lt;/STRONG&gt;.&amp;nbsp; &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Feb 2013 13:05:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/LOAD-DISTINCT-and-Preceding-Loads/m-p/392199#M698308</guid>
      <dc:creator />
      <dc:date>2013-02-01T13:05:54Z</dc:date>
    </item>
  </channel>
</rss>

