Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

How I can set a variable with value given from more table

Hello,

I have N tables with the same format, and how I want is set a Variable that will be the sum of the Column X with a particular condition.

Immagine1.pngImmagine2.png

I would like to set in Edit script vTotAge from all table that I have.

Somethings like this :

if(Nome='Pippo') then Sum(Age) from Table1   as TotTab1;

if(Nome='Pippo') then Sum(Age) from Table2 as TotTab2;

..

..

if(Nome='Pippo') then Sum(Age) from TableN as TotTabN;


vTotAge = TotTab1+ TotTab2+...+ TotTabN

Someone have a Solution for my Problem.

Thanks in advances

4 Replies
Highlighted
Creator II
Creator II

Re: How I can set a variable with value given from more table

If someone can advise me other solutions for this it is good anyway..

Champion
Champion

Re: How I can set a variable with value given from more table

Well, if you have N tables with same format, would suggest do the caoncatenation of all the tables and make it one and then try sum(Age)..

Else do something like: aggr(sum(Age),Nome)

Highlighted
MVP
MVP

Re: How I can set a variable with value given from more table

First Concatenate all the tabels

Load Nome,

        sum(Age) as Age

From table1

group by Nome

concatenate

Load Nome,

        sum(Age) as Age

From table2

group by Nome



Now you can simply write expression in Chart as sum(Age)

Highlighted
Partner
Partner

Re: How I can set a variable with value given from more table

Hi,

As stated by the people above, I would advise that you concatenate the tables together.

I would add a new field like

'Table1' As Table

So if needed you can pick out values from individual tables.

Mark