<?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 Grouping data from a table using fields from a second table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Grouping-data-from-a-table-using-fields-from-a-second-table/m-p/210671#M65173</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to create a report for earnings and expenses based on accounting records.&lt;/P&gt;&lt;P&gt;So I have a table that contains all detailed earnings and expenses, where the account numbers are 6 numbers format (such as 700110, 606300 and so on).&lt;/P&gt;&lt;P&gt;I have no problem creating a new table grouping by the account number.&lt;/P&gt;&lt;P&gt;But here comes the tricky part : the report I need to create use another aggregation criteria.&lt;BR /&gt;For this, I have a second table that lists the aggregation criteria :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;700&lt;BR /&gt;72100&lt;BR /&gt;730&lt;BR /&gt;60&lt;BR /&gt;6061&lt;BR /&gt;60630&lt;BR /&gt;.....&lt;BR /&gt;68100&lt;BR /&gt;68174&lt;BR /&gt;69&lt;BR /&gt;75&lt;BR /&gt;76&lt;BR /&gt;77&lt;BR /&gt;78&lt;BR /&gt;79&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;For example, the first account is 700. This means that I need to sum all amounts from accounts that begin with 700, which would be for example 700110, 700190 and so on.&lt;/DIV&gt;&lt;DIV&gt;Beware: if you look at the 4th to 6th line, you have accounts number 60, 6061 and 60630. This means that the account 60 must hold all accounts beginning with 60, including accounts 6061 and 60630 !&lt;/DIV&gt;&lt;DIV&gt;Of course, the resulting table should display the accounts in the same order as the second table...&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Vincent&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Oct 2009 15:15:09 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-10-08T15:15:09Z</dc:date>
    <item>
      <title>Grouping data from a table using fields from a second table</title>
      <link>https://community.qlik.com/t5/QlikView/Grouping-data-from-a-table-using-fields-from-a-second-table/m-p/210671#M65173</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to create a report for earnings and expenses based on accounting records.&lt;/P&gt;&lt;P&gt;So I have a table that contains all detailed earnings and expenses, where the account numbers are 6 numbers format (such as 700110, 606300 and so on).&lt;/P&gt;&lt;P&gt;I have no problem creating a new table grouping by the account number.&lt;/P&gt;&lt;P&gt;But here comes the tricky part : the report I need to create use another aggregation criteria.&lt;BR /&gt;For this, I have a second table that lists the aggregation criteria :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;700&lt;BR /&gt;72100&lt;BR /&gt;730&lt;BR /&gt;60&lt;BR /&gt;6061&lt;BR /&gt;60630&lt;BR /&gt;.....&lt;BR /&gt;68100&lt;BR /&gt;68174&lt;BR /&gt;69&lt;BR /&gt;75&lt;BR /&gt;76&lt;BR /&gt;77&lt;BR /&gt;78&lt;BR /&gt;79&lt;/P&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;For example, the first account is 700. This means that I need to sum all amounts from accounts that begin with 700, which would be for example 700110, 700190 and so on.&lt;/DIV&gt;&lt;DIV&gt;Beware: if you look at the 4th to 6th line, you have accounts number 60, 6061 and 60630. This means that the account 60 must hold all accounts beginning with 60, including accounts 6061 and 60630 !&lt;/DIV&gt;&lt;DIV&gt;Of course, the resulting table should display the accounts in the same order as the second table...&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Vincent&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2009 15:15:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Grouping-data-from-a-table-using-fields-from-a-second-table/m-p/210671#M65173</guid>
      <dc:creator />
      <dc:date>2009-10-08T15:15:09Z</dc:date>
    </item>
    <item>
      <title>Grouping data from a table using fields from a second table</title>
      <link>https://community.qlik.com/t5/QlikView/Grouping-data-from-a-table-using-fields-from-a-second-table/m-p/210672#M65174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK I tried this :&lt;/P&gt;&lt;P&gt;FOR each Account in '700','730','60','6061','60630',61,612,613,615,616,618,62,621,622,623,624,625,626,627,628,63,631,63380,635,636,637,638,64,641,645,647,65,66,67,671,672,675,678,68,68100,68174,69,75,76,77,78,79,79&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;AccountBalance,&lt;BR /&gt;AccountLabel,&lt;BR /&gt;Month,&lt;BR /&gt;left(AccoutBalance,,len('$(Account)')) as NewAccount&lt;BR /&gt;RESIDENT AccountBalances&lt;BR /&gt;WHERE left(AccountBalance,len('$(Account)'))='$(Account)';&lt;/P&gt;&lt;P&gt;NEXT Account;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;It works, although it is not super elegant to say the least.&lt;/P&gt;&lt;P&gt;It would be great if I could load the new account numbers values in the FOR EACH STATEMENT from a file, but I did not succeed...yet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a better way to do that (I guess there is), please express yourself !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Oct 2009 16:53:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Grouping-data-from-a-table-using-fields-from-a-second-table/m-p/210672#M65174</guid>
      <dc:creator />
      <dc:date>2009-10-08T16:53:51Z</dc:date>
    </item>
  </channel>
</rss>

