Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How can an additional data set with identical columns be added without breaking existing calculated fields?

I'm having trouble adding an additional dataset without breaking my existing calculations. A) is there a way to get Qlik to automatically refactor everything B) how can I avoid this being a massive pain in the neck to fix?

Let's say I have a table "Table1", from which I've built everything so far from. Now, if I upload an additional file, let's call it Table2, with identical columns, Qlik tries to union the two tables. They should be separate, so I go in and "Split" them.

All my current formulas don't specify the table, since it's not necessary for a single data source

Now, Table2 is correct in that every field is Table2.ID, Table2.Price, etc.

Table1 is a disaster though, because it's now Table1.Table1.ID, Table1.Table1.Price, etc. On top of that, Qlik doesn't automatically refactor everything to the new variable names (like it should).

How do I solve this problem?

1 Reply
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Henry,

As I understood, you just need to redo your calculations for both tables right?

In this case, you can use the NoConcatenate statement for table two, since it has the same fields as table one and do the calculations for both, like so:

Table1:

Load *

From [Whatever];

// Calculations are made here

NoConcatenate

Table2:

Load *

From [Whaveter2];

// Same Calculations from table1 on table2 are made here

since you don't specify the qualified field names (Table1.ID, Table2.ID and so on) if you do exactly the same for both tables should do the trick.

I would do a sub, with a table name as a parameter to do the same calculations and make an iteration for the number of tables you need (your input files) so you only need to code it once and reuse it, like:

sub calculations(TableName)

     // Example Calculations here

     // this would join a flag to the specified table

     left join ('$(TableName)')

     Load

               #Key,

               1 as [Flag Whatever]

     Resident [$(TableName)];

end sub;

// assuming you only have two tables loaded at this poin

for i = 0 to NoOfTables()-1

     let vTableName = TableName($(i));

     call calculations('$(vTableName)');

end if;