Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subquery on a Script

Hello Experts,

Is it possible create a subquery like this example?

I need aggregate data of two or more tables. Tks



create table Test

from ( table1:

load column1, column2

from Text_file1;

add load column1, column2

from textfile2)

14 Replies
Not applicable
Author

Yes!! correct!

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi there,

You do not need to be concatenating or joining the tables at all in the load script. In fact you need to be sure that you don't. The two tables should be loaded separately and will be joined in the data model by virtue of the fact that the field Client exists in both tables.

Check the table viewer after a reload to check that this is happening.

Once the data is in create a chart with a dimension of Client and two expressions SUM(Sale) and SUM(Budget). You can select to show your chart as a 'Straight Table'. This should give you the results that you are after.

If you add the values in a Table Box then the numbers will not be aggregated and you will get the scenario where you see the two separate values for Sale and the value for Budget shown twice. It is rare that you will ever want to put a numeric value in a Table Box - it is almost always preferable to use a Chart with a Chart Type of straight table.

I can post up an example of this working if you require.

Regards,
Steve

Not applicable
Author

Could You post this example?

Not applicable
Author

Tks Steve! It is ok!!

QlikView is the best BI tool!!!!

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Alexandre,

Glad it is now working for you.

Regards,
Steve