Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Add new calculated dimension for a group of merged tables

Hello,

I have the following Group of csv tables loaded in my Qliksense:

Transactions 012015

Transactions 022015

Transaction 032015

...

Transactions 122015

As all of these tables have the same number of dimensions and the same Dimension names, they are automatically merged into 1 unique final table.

My question is : how can I add a new calculated Dimension that would be applied to this final table.

I would like to avoid inserting this script in the load script of every single monthly table, and just to write it once for all.

Thank you

3 Replies
Employee
Employee

Re: Add new calculated dimension for a group of merged tables

The best way is to define it in the script, but you should use a loop so you only have your dimension defined in one place:

For each vFile in FileList('C:\Path\Transactions*.csv')
Load *,
   
FileName() as FileName,
      <SomeFormula> as NewDimension
      From "$(vFile)" (...) ;
Next vFile

But it is also possible to do it in a chart or in the Qlik Sense asset panel. Just start writing a formula with a leading equals sign.

HIC

See also Loops in the Script

pierre_fr
New Contributor

Re: Add new calculated dimension for a group of merged tables

Another way is to create the dimensions after the concatenated table is created, through

<Load all CSV files in order to get MyConcatenatedTable>, followed by

LEFT JOIN (MyConcatenatedTable)

LOAD

          [Primary key(s)],

          MyFormula as NewDimension

RESIDENT MyConcatenatedTable;

Just be careful on performance, depending on the amount of records.

Not applicable

Re: Add new calculated dimension for a group of merged tables

Thank you both for your answers.

Actually I just found an even simpler solution. I just kept the script of the loading of my first file, and I replaced the name "Transactions012015.csv" by "*.csv".

Then Qliksense loads automatically all the csv files of the folder and merges all the tables.

Community Browser