<?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: Importing Excel data with subtotal header rows in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818704#M67110</link>
    <description>&lt;P&gt;there are two steps t this.&amp;nbsp; first load your data in a table format not report format:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD
    if(match(Weight,'Equities', 'Foreign Currency')&amp;gt;0 ,Weight, Peek(Category)) as Category,
    if(match(Weight,'Equities', 'Foreign Currency')=0 ,Weight) as Country,
    F2 as Amount
FROM [....xlsx]
(ooxml, embedded labels, table is Sheet1);&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 29 Jun 2021 20:33:59 GMT</pubDate>
    <dc:creator>edwin</dc:creator>
    <dc:date>2021-06-29T20:33:59Z</dc:date>
    <item>
      <title>Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818641#M67095</link>
      <description>&lt;P&gt;I'm trying to import into QlikSense from a monthly excel file that looks like the table below. It has different subheadings for Equities and Foreign Currency and below those subheadings there can be rows that appear multiple times (Australia, Canada, UK in this example).&lt;/P&gt;&lt;P&gt;Excel Data:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Weight&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Equities&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;123.0%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Australia&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 78.9%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Canada&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 42.8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; United Kingdom&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp; 1.4%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Foreign Currency&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;136.4%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Australia&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 13.3%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Canada&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 64.8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; United Kingdom&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 58.2%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to import this into Qliksense and have the below result, where Australia would have Equity and Foreign Currency in 2 seperate columns, can anyone help? The Excel file typically will have data in consistent rows (i.e. Australia Foreign Currency in the same row each time, UK Equities same row each time) but the ideal solution would not rely on consistent row numbers or spacing to get this result.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Subtotal categories are predefined (i.e. they will always be the same Equities or Foreign Currency) but it's possible that the countries under each heading could change.&lt;/P&gt;&lt;P&gt;Desired Result:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Equities&lt;/TD&gt;&lt;TD&gt;Foreign Currency&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 78.9%&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 13.3%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Canada&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 42.8%&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 64.8%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;United Kingdom&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&amp;nbsp; 1.4%&lt;/TD&gt;&lt;TD&gt;&amp;nbsp; 58.2%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 29 Jun 2021 16:41:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818641#M67095</guid>
      <dc:creator>schow</dc:creator>
      <dc:date>2021-06-29T16:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818704#M67110</link>
      <description>&lt;P&gt;there are two steps t this.&amp;nbsp; first load your data in a table format not report format:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;LOAD
    if(match(Weight,'Equities', 'Foreign Currency')&amp;gt;0 ,Weight, Peek(Category)) as Category,
    if(match(Weight,'Equities', 'Foreign Currency')=0 ,Weight) as Country,
    F2 as Amount
FROM [....xlsx]
(ooxml, embedded labels, table is Sheet1);&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 29 Jun 2021 20:33:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818704#M67110</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-06-29T20:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818705#M67111</link>
      <description>&lt;P&gt;you can actually stop there and use expressions to create your table.&lt;/P&gt;&lt;P&gt;you can explore pivoting your data to get it in a table form that you wanted:&lt;/P&gt;&lt;P&gt;here is a way to do it:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/The-Generic-Load/ba-p/1473470" target="_blank" rel="noopener noreferrer"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/The-Generic-Load/ba-p/1473470&lt;/A&gt;&lt;/P&gt;&lt;P&gt;or if you have very limited measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;XLS: LOAD
if(match(Weight,'Equities', 'Foreign Currency')&amp;gt;0 ,Weight, Peek(Category)) as Category,
if(match(Weight,'Equities', 'Foreign Currency')=0 ,Weight) as Country,
F2 as Amount FROM [....xlsx](ooxml, embedded labels, table is Sheet1);
NoConcatenate XLSdata:load Country, Amount as Equities
Resident XLS where Category='Equities' and not isnull(Country);
inner join (XLSdata) load Country, Amount as [Foreign Currency]
Resident XLS where Category='Foreign Currency' and not isnull(Country);
drop table XLS;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 20:38:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818705#M67111</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-06-29T20:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818706#M67112</link>
      <description>&lt;P&gt;this assumes that a country will always have both categories, else do a full outer join&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 20:39:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818706#M67112</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-06-29T20:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818712#M67115</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/58578"&gt;@edwin&lt;/a&gt;&amp;nbsp; Thanks for your answer. Unfortunately the countries are not consistent between categories. I.e. you might have some countries in Equities that are not in Foreign Currency and vice versa. I should have included that in my post.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 22:08:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818712#M67115</guid>
      <dc:creator>schow</dc:creator>
      <dc:date>2021-06-29T22:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818713#M67116</link>
      <description>&lt;P&gt;For now I'm loading each section of the excel file seperately based on the row numbers and categorizing it manually something like this below (there are a few more fields in my data set but i just kept it simple in my example).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;date AS EFF_DATE,&lt;BR /&gt;F1 AS Category,&lt;BR /&gt;'Equities' as "Asset_Class",&lt;BR /&gt;"Exposure" as "Weight",&lt;BR /&gt;"Exposure as&amp;nbsp;Var" as "Var weight"&lt;BR /&gt;FROM [file.xls]&lt;BR /&gt;(ooxml, embedded labels, header is 2 lines, table is Sheet1)&lt;BR /&gt;where RecNo()&amp;gt;=5 AND RecNo()&amp;lt;=9;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then repeating that for each asset class category (equities, fx etc) with different RecNo() numbers to get all the different asset classes. This works but I feel like there must be a better way? I'm worried that the rows and categories may at some point change which would require a lot of recoding. The excel input file is from an external source so i can't control it's formatting.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2021 22:15:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818713#M67116</guid>
      <dc:creator>schow</dc:creator>
      <dc:date>2021-06-29T22:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818722#M67118</link>
      <description>&lt;P&gt;The categories should be consistent even if the countries arent&lt;/P&gt;&lt;P&gt;this shows you the full outer join&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/sense/May2021/Subsystems/Hub/Content/Sense_Hub/Scripting/combine-tables-join-keep.htm" target="_blank"&gt;https://help.qlik.com/en-US/sense/May2021/Subsystems/Hub/Content/Sense_Hub/Scripting/combine-tables-join-keep.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 01:37:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818722#M67118</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-06-30T01:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818913#M67138</link>
      <description>&lt;P&gt;I tried this on my simple example table and this is the result I'm getting. It has the right columns but all of the data is lost in the transformation. Think I might be missing something here.&lt;/P&gt;&lt;P&gt;Could you explain more on how an outer join would solve this problem? The core issue i'm struggling to understand is how the script will find the header rows (eg "Equity") and then code that header into a new column only for the rows immediately below the header row (up until it finds a blank row, which will be followed by another header row).&amp;nbsp;&lt;/P&gt;&lt;P&gt;There's about 8 different Headers that are predefined, so I can have those in a set list before hand.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="schow_1-1625065887214.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/57794i221D01BF1AB0F878/image-size/medium?v=v2&amp;amp;px=400" role="button" title="schow_1-1625065887214.png" alt="schow_1-1625065887214.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jun 2021 15:15:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1818913#M67138</guid>
      <dc:creator>schow</dc:creator>
      <dc:date>2021-06-30T15:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1819130#M67151</link>
      <description>&lt;P&gt;dont use line numbers that will be a problem down the road.&lt;/P&gt;&lt;P&gt;if you follow the code and just remove the "inner" and leave it as just JOIN, even if the countries are consistent, you will stil get the right result based on your samples.&amp;nbsp; this one i added other countries to make them not consistent:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="edwin_0-1625149861015.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/57831i95083F6D5242BA77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="edwin_0-1625149861015.png" alt="edwin_0-1625149861015.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jul 2021 14:32:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1819130#M67151</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-07-01T14:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1819141#M67153</link>
      <description>&lt;P&gt;this is what i used:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;input:
load * inline [
Category, Weight
Equities,123.0%
Australia,78.9%
Canada,42.8%
United Kingdom,1.4%
Ice Land,42.8%

 	 
Foreign Currency,136.4%
Australia,13.3%
Canada,64.8%
United Kingdom,58.2%

Mexico,64.8%
Argentina,58.2%
];

data:
LOAD
    if(match(Category,'Equities', 'Foreign Currency')&amp;gt;0 ,Category, Peek(Category)) as Category,
    if(match(Category,'Equities', 'Foreign Currency')=0 ,Category) as Country,
    Weight as Amount
resident input;

drop table input;

NoConcatenate XLSdata:load Country, Amount as Equities
Resident data where Category='Equities' and not isnull(Country);

 join (XLSdata) load Country, Amount as [Foreign Currency]
Resident data where Category='Foreign Currency' and not isnull(Country);
drop table data;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Jul 2021 14:47:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1819141#M67153</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-07-01T14:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1819913#M67217</link>
      <description>&lt;P&gt;Thanks for your help&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/58578"&gt;@edwin&lt;/a&gt;&amp;nbsp;! That worked, much appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 19:14:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1819913#M67217</guid>
      <dc:creator>schow</dc:creator>
      <dc:date>2021-07-05T19:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Excel data with subtotal header rows</title>
      <link>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1820805#M67288</link>
      <description>&lt;P&gt;np&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 17:53:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Importing-Excel-data-with-subtotal-header-rows/m-p/1820805#M67288</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2021-07-08T17:53:58Z</dc:date>
    </item>
  </channel>
</rss>

