<?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 Script - Filter results by summary data in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735946#M56237</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/59766"&gt;@WeePecky&lt;/a&gt;&amp;nbsp;&amp;nbsp;So you don't have a table with the Count Of Type? You need to create this in order to do the rest of the analysis?&lt;/P&gt;&lt;P&gt;Is the data in QVDs as I assumed? If so, you are looking for something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Summary:
LOAD
    *
    WHERE [Count of Type] &amp;gt;= 11
    ;
LOAD
    ID &amp;amp; ':' &amp;amp; Quarter as IDQtr,
    count(DISTINCT Type) as [Count of Type]
FROM [lib://QVD/Detail.qvd] (qvd)
GROUP BY ID, [Year-Quarter];

Detail:
LOAD
   *
FROM [lib://QVD/Detail.qvd] (qvd)
WHERE EXISTS(IDQtr, ID &amp;amp; ':' &amp;amp; Quarter);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using QVDs, you will find that the process runs &lt;STRONG&gt;much&lt;/STRONG&gt; quicker if you create the&amp;nbsp;IDQtr field when you create the QVD rather than when you load from it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Aug 2020 13:08:09 GMT</pubDate>
    <dc:creator>stevedark</dc:creator>
    <dc:date>2020-08-14T13:08:09Z</dc:date>
    <item>
      <title>Load Script - Filter results by summary data</title>
      <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735428#M56182</link>
      <description>&lt;P&gt;Greetings,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a set of data that is summarised to show only those items that have 11 or more different 'types'.&lt;/P&gt;&lt;P&gt;e.g.:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="40px" height="25px"&gt;ID&lt;/TD&gt;&lt;TD width="96px" height="25px"&gt;Year-Quarter&lt;/TD&gt;&lt;TD width="112px" height="25px"&gt;Count of 'Type'&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="40px" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="64px" height="25px"&gt;2017-01&lt;/TD&gt;&lt;TD width="40px" height="25px"&gt;17&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="40px" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="64px" height="25px"&gt;2018-02&lt;/TD&gt;&lt;TD width="40px" height="25px"&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="40px" height="25px"&gt;3&lt;/TD&gt;&lt;TD width="64px" height="25px"&gt;2019-03&lt;/TD&gt;&lt;TD width="40px" height="25px"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wanting to use this summary data to filter out IDs from the detailed results so only the details of those results with 11 or more 'Types' per quarter are included in the result set.&lt;/P&gt;&lt;P&gt;Any assistance appreciated.&lt;/P&gt;&lt;P&gt;Kindest regards&lt;BR /&gt;Wee&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:41:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735428#M56182</guid>
      <dc:creator>WeePecky</dc:creator>
      <dc:date>2024-11-16T01:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - Filter results by summary data</title>
      <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735462#M56189</link>
      <description>&lt;P&gt;tmpDetailed:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;ID &amp;amp; '|' &amp;amp; "Year-Quarter" AS IDPeriod.#key;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;ID,&lt;/P&gt;&lt;P&gt;"Year-Quarter",&lt;/P&gt;&lt;P&gt;Type,&lt;/P&gt;&lt;P&gt;Datafield1,&lt;/P&gt;&lt;P&gt;Datafield2,&lt;/P&gt;&lt;P&gt;Datafield3&lt;/P&gt;&lt;P&gt;FROM [$(g_data)/data.qvd] (qvd);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Summary:&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;ID &amp;amp; '|' &amp;amp; "Year-Quarter" AS LookupIDPeriod.#key&lt;/P&gt;&lt;P&gt;WHERE TypeCount&amp;gt;10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;ID,&lt;/P&gt;&lt;P&gt;"Year-Quarter",&lt;/P&gt;&lt;P&gt;Count(Type) as TypeCount&lt;/P&gt;&lt;P&gt;Resident tmpDetailed&lt;/P&gt;&lt;P&gt;Group by ID,"Year-Quarter";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Detailed:&lt;/P&gt;&lt;P&gt;NoConcatenate&lt;/P&gt;&lt;P&gt;LOAD * RESIDENT tmpDetailed&lt;/P&gt;&lt;P&gt;WHERE EXISTS(LookupIDPeriod.#key,IDPeriod.#key);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DROP TABLE tmpDetailed;&lt;/P&gt;&lt;P&gt;DROP FIELDS&amp;nbsp;LookupIDPeriod.#key,IDPeriod.#key;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 06:41:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735462#M56189</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2020-08-13T06:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - Filter results by summary data</title>
      <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735494#M56192</link>
      <description>&lt;P&gt;You will want to use the WHERE EXISTS clause. This is a simple way of doing the equivalent of an INNER JOIN between tables in Qlik - provided there is only one field in common between the tables.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Summary:
LOAD
    ID,
    [Year-Quarter],
    [Count of Type]
FROM [lib://QVD/Summary.qvd] (qvd)
WHERE [Count of Type] &amp;gt;= 11;

Detail:
LOAD
   *
FROM [lib://QVD/Detail.qvd] (qvd)
WHERE EXISTS(ID);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the field that you are matching on has a different name in the Detail table to the Summary table you need to specify both field names in the EXISTS statement.&lt;/P&gt;&lt;P&gt;So it would be:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;WHERE EXISTS (ID, DetailID)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that works out for you.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Thu, 13 Aug 2020 08:16:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735494#M56192</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2020-08-13T08:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - Filter results by summary data</title>
      <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735814#M56225</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6748"&gt;@stevedark&lt;/a&gt;&amp;nbsp; Thanks.&amp;nbsp;&lt;BR /&gt;Sadly that did not work.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I still get results back that are under the count of 11.&lt;BR /&gt;&lt;BR /&gt;[EDIT] I believe I failed to mention that the Type column can contain many values for the same ID, eg 15 of type Black and 12 of Type Purple, and only the unique count of this field should be considered when counting the Types. My apologies I should have been more diligent in the original post. &amp;lt;homer&amp;gt;doh!&amp;lt;/homer&amp;gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So where there are 2000 types, if all 2000 are the same type then the count is 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The form of the detail includes the quarter as well as the ID an the match needs to include both columns.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The detail table looks like this:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;Quarter&lt;/TD&gt;&lt;TD&gt;Type&lt;/TD&gt;&lt;TD&gt;Data 1&lt;/TD&gt;&lt;TD&gt;Data 2&lt;/TD&gt;&lt;TD&gt;Data 3&lt;/TD&gt;&lt;TD&gt;Data 4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;201701&lt;/TD&gt;&lt;TD&gt;Hot&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;201701&lt;/TD&gt;&lt;TD&gt;Warm&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;201701&lt;/TD&gt;&lt;TD&gt;Cold&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;TD&gt;some data&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;I have tried matching on two columns but the results are the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;11 different types are required for an ID for Quarter to be reported.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 02:15:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735814#M56225</guid>
      <dc:creator>WeePecky</dc:creator>
      <dc:date>2020-08-14T02:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - Filter results by summary data</title>
      <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735946#M56237</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/59766"&gt;@WeePecky&lt;/a&gt;&amp;nbsp;&amp;nbsp;So you don't have a table with the Count Of Type? You need to create this in order to do the rest of the analysis?&lt;/P&gt;&lt;P&gt;Is the data in QVDs as I assumed? If so, you are looking for something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Summary:
LOAD
    *
    WHERE [Count of Type] &amp;gt;= 11
    ;
LOAD
    ID &amp;amp; ':' &amp;amp; Quarter as IDQtr,
    count(DISTINCT Type) as [Count of Type]
FROM [lib://QVD/Detail.qvd] (qvd)
GROUP BY ID, [Year-Quarter];

Detail:
LOAD
   *
FROM [lib://QVD/Detail.qvd] (qvd)
WHERE EXISTS(IDQtr, ID &amp;amp; ':' &amp;amp; Quarter);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using QVDs, you will find that the process runs &lt;STRONG&gt;much&lt;/STRONG&gt; quicker if you create the&amp;nbsp;IDQtr field when you create the QVD rather than when you load from it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 13:08:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1735946#M56237</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2020-08-14T13:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - Filter results by summary data</title>
      <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1736042#M56241</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6748"&gt;@stevedark&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I do have a summary dataset, which is in a qvd file. My apologies for not being clear.&lt;/P&gt;&lt;P&gt;I have millions of rows across multiple quarters, which renders hundreds of thousands of matching types per quarter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am perplexed as to why your solution does not work. I am working through this, and will post the solution and reason for this not working when we have discovered it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!!&lt;/P&gt;&lt;P&gt;Wee&lt;/P&gt;</description>
      <pubDate>Fri, 14 Aug 2020 18:55:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1736042#M56241</guid>
      <dc:creator>WeePecky</dc:creator>
      <dc:date>2020-08-14T18:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - Filter results by summary data</title>
      <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1736132#M56252</link>
      <description>&lt;P&gt;Given the large number of rows I would definitely look at chunking up the load into various parts.&lt;/P&gt;&lt;P&gt;Create an aggregated QVD using the GROUP BY as a separate part of the process to the main load script.&lt;/P&gt;&lt;P&gt;When loading from the aggregated QVD, a WHERE EXISTS on possible counts would be quicker, or better still create a field called 11 Plus in the QVD and use that in a WHERE EXISTS.&lt;/P&gt;&lt;P&gt;Creating the composite key (ID &amp;amp; ':' &amp;amp; Quarter) when creating the QVD rather than on the fly goes from being a 'good idea' to being essential - due to &lt;A href="https://www.quickintelligence.co.uk/qlikview-optimised-qvd-loads/" target="_blank" rel="noopener"&gt;optimised QVD loads&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Sat, 15 Aug 2020 16:19:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1736132#M56252</guid>
      <dc:creator>stevedark</dc:creator>
      <dc:date>2020-08-15T16:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Load Script - Filter results by summary data</title>
      <link>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1736224#M56272</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/103456"&gt;@RsQK&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6748"&gt;@stevedark&lt;/a&gt;&amp;nbsp; thank you for your input.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both of your solutions are correct for the problem as described.&lt;BR /&gt;&lt;BR /&gt;I had already created the summary with the count of "type" and was joining the two qvd files to each other, and tried to get the Exists clause to work as you advised .&lt;BR /&gt;&lt;BR /&gt;The real problem was that there was an age field that (obviously) changed for some ID's (people are just the worst!) during the quarter. Once I used min on the age fields all my dreams came true!&amp;nbsp;&lt;/P&gt;&lt;P&gt;My apologies to you good gents, and thank you for your time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tossed a coin, and have marked &amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6748"&gt;@stevedark&lt;/a&gt;&amp;nbsp;as the solution. Sorry&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/103456"&gt;@RsQK&lt;/a&gt;&amp;nbsp;.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Kindest regards&lt;/P&gt;&lt;P&gt;Wee&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 20:55:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Load-Script-Filter-results-by-summary-data/m-p/1736224#M56272</guid>
      <dc:creator>WeePecky</dc:creator>
      <dc:date>2020-08-16T20:55:05Z</dc:date>
    </item>
  </channel>
</rss>

