Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
paulosrl
Contributor III
Contributor III

Dynamic chart from two lists

Hello, I need to build a chart that compares the total (multiple) items I choose in a list box (left) with a specific item from another list box (right). There are two list boxes, one with the items that will compose the total (blue bar) and another list box only with the items that I need to compare (red bar). I tried as it is on qvw but it did not work.Capturar.PNG

1 Solution

Accepted Solutions
boorgura
Specialist
Specialist

Please add 2 island field.

Test:

LOAD YEAR(DATA_LANCAMENTO) as Ano,

     DESCRICAO_LANCAMENTO as "Lancamento",

     DESCRICAO_LANCAMENTO as "Lancamento2",

     DATA_LANCAMENTO as Data,

     VALOR_TRANSACAO as Valor,

     if(NATUREZA_LANCAMENTO='C','Crédito',if (NATUREZA_LANCAMENTO='D','Débito','Dep. bloqueado')) as "Tipo de Lancamento"

FROM

[Test.qvd]

(qvd);

List:

NoConcatenate

LOAD

if([Tipo de Lancamento]='Crédito',Lancamento) as List1

Resident Test;

List2:

NoConcatenate

LOAD

if([Tipo de Lancamento]='Crédito',Lancamento2) as List2

Resident Test;

On the UI, your expressions will be

1) =Sum({< [Tipo de Lancamento] = {'Crédito'}, Lancamento = {"$(=concat(List1, '","'))"} >} Valor)

2) = Sum({< Lancamento = {"$(=concat(List2, '","'))"}, [Tipo de lancamento] = {'Crédito'} >} Valor)

View solution in original post

4 Replies
boorgura
Specialist
Specialist

Please add 2 island field.

Test:

LOAD YEAR(DATA_LANCAMENTO) as Ano,

     DESCRICAO_LANCAMENTO as "Lancamento",

     DESCRICAO_LANCAMENTO as "Lancamento2",

     DATA_LANCAMENTO as Data,

     VALOR_TRANSACAO as Valor,

     if(NATUREZA_LANCAMENTO='C','Crédito',if (NATUREZA_LANCAMENTO='D','Débito','Dep. bloqueado')) as "Tipo de Lancamento"

FROM

[Test.qvd]

(qvd);

List:

NoConcatenate

LOAD

if([Tipo de Lancamento]='Crédito',Lancamento) as List1

Resident Test;

List2:

NoConcatenate

LOAD

if([Tipo de Lancamento]='Crédito',Lancamento2) as List2

Resident Test;

On the UI, your expressions will be

1) =Sum({< [Tipo de Lancamento] = {'Crédito'}, Lancamento = {"$(=concat(List1, '","'))"} >} Valor)

2) = Sum({< Lancamento = {"$(=concat(List2, '","'))"}, [Tipo de lancamento] = {'Crédito'} >} Valor)

boorgura
Specialist
Specialist

You can as well set your second list box (List2) to have "always one selected value"

paulosrl
Contributor III
Contributor III
Author

Thanks a lot! Works fine 🙂

boorgura
Specialist
Specialist

Great. Happy to help!

When you get a chance, please Mark the question as answered.