Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
pascos88
Contributor

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
pascos88
Contributor

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..

balrajahlawat
Esteemed Contributor

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)

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)

mark6505
Valued Contributor III

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

Community Browser