Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
nagaiank
Specialist III
Specialist III

Cross-Table load from Excel files

Hello, I was not able to find a solution in the forum to the following scenario.

In order load three month sales data from Excel using CrossTable prefix, the data file and script are below:

Capture3.PNG

Sales:

CrossTable(Month, Sales)

LOAD Region,

     [42370],

     [42401],

     [42430]

FROM ...

If the fourth month data is added, the script has to be changes to

Sales:

CrossTable(Month, Sales)

LOAD Region,

     [42370],

     [42401],

     [42430],

     [42461]

FROM ...

Is there a way to arrive at a script which will detect the number of months for which the data exists in the Excel file and load data for all months, not requiring to modify script every month?

Thanks in advance for your help.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

If the order of your fields in the input table is Region, then all Month fields, you should be fine with

Sales:

CrossTable(Month, Sales)

LOAD *

FROM ...

View solution in original post

3 Replies
swuehl
MVP
MVP

If the order of your fields in the input table is Region, then all Month fields, you should be fine with

Sales:

CrossTable(Month, Sales)

LOAD *

FROM ...

nagaiank
Specialist III
Specialist III
Author

Thank you Stefan. It worked.

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I agree with Stefan's suggestion. I think you can try the suggestion below as well. This is doing Preceding Load, if you add another month to the Inline table now it will be included in the CrossTable.

Data:

CrossTable(Month,Sales)

LOAD *

;

LOAD * INLINE [

    Region, Jan-2016, Feb-2016, Mar-2016, Apr-2016

    UK, 200, 563, 897

    Manchester, 33, 321, 546

    Birmingham, 1005, 200, 22

    Leverpool, 899, 546, 145

    Florida,    800,563,546,3300

];