<?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: Random data selector in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201039#M878463</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;thanks once again for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have got this working, using your revised code - not sure what was going wrong when i first did it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aaron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Oct 2016 13:27:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-10-25T13:27:02Z</dc:date>
    <item>
      <title>Random data selector</title>
      <link>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201035#M878459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let me set the scene for you. I am running a ticket quality survey each month, and i need qlikview to pick 5 random rows (in the attached file) for each "Creator" field for the previous month. The other conditions are that the "Creator" must be the same as the "Person Resolved" and the Status must be 'Cleared' or 'Closed' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The attached data may not contain enough info to generate the sample data - however the live data i am working with will have enough data. (I cant post live data). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please let me know if you need any further info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance in my quest would be very much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201035#M878459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Random data selector</title>
      <link>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201036#M878460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe something like this:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;MyTable:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LOAD *&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;WHERE [Count] &amp;lt;= 5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LOAD some fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;,if([Creator] = peek([Creator]),peek([Count])+1,1) as [Count]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FROM your file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;WHERE [Creator] = [Person Resolved]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;AND match([Status],'Cleared','Closed')&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;AND monthstart([Create Date]) = monthstart(today(),-1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;ORDER BY [Creator]&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or not quite what you want, but a likely faster way to get a random selection is to use a sample load, where you give it a probability of loading each row. Something like this, I think.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;MyTable:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;SAMPLE 0.05 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LOAD some fields&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;FROM your file&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;WHERE [Creator] = [Person Resolved]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;AND match([Status],'Cleared','Closed')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;AND monthstart([Create Date]) = monthstart(today(),-1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;edit: added previous month check&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2016 00:00:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201036#M878460</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-10-18T00:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Random data selector</title>
      <link>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201037#M878461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John.&lt;/P&gt;&lt;P&gt;thanks for the code. Its useful, but not delivering the desired results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting a random selection - however, it is not giving me the 5 rows per creator. sometimes it gives me a couple and sometimes quite a few (up to 12).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, its not selecting the rows from the previous month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It might be that the sample data isn't sufficient - but the fact that i was getting more than 5 of the same creator suggests otherwise?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know my requirements are quite specific, therefore it may not be as straight forward as i thought it could be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 08:43:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201037#M878461</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-19T08:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Random data selector</title>
      <link>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201038#M878462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The second bit of script would be expected to give random results. But the first bit of script gives me exactly 5 records per creator when sourcing from 5000 random records. See attached.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hadn't noticed that you only wanted records from the previous month. I hope it's clear how to add additional qualifications to what sample data you retrieve. (edit: added to previous reply)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Oct 2016 16:59:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201038#M878462</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2016-10-19T16:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Random data selector</title>
      <link>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201039#M878463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;thanks once again for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have got this working, using your revised code - not sure what was going wrong when i first did it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aaron&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Oct 2016 13:27:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Random-data-selector/m-p/1201039#M878463</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-25T13:27:02Z</dc:date>
    </item>
  </channel>
</rss>

