Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

pascos88
Contributor

is possible return 2 expression in one if condition?

I need to return 2 expression in one if condition.

i.e   

     if(vVariable = 'Yes', Only(A) and Only(B), if(vVariable='No', Only(C) and Only(D)))

A and B or C and D will be show like a bar in the same chart.

Thanks for replay

Pasquale

1 Solution

Accepted Solutions

Re: is possible return 2 expression in one if condition?

No, this is one chart that dynamically changes almost everything when you press a different button at the top.

Indeed, the addition with other amounts will follow the same logic.

If you're not using a PE Desktop, you can use the document in attachment to figure out how these screenshots were made.

Best,

Peter

23 Replies
Not applicable

Re: is possible return 2 expression in one if condition?

could u share any sample data

mark6505
Valued Contributor III

Re: is possible return 2 expression in one if condition?

Hi,


What exactly you trying to do?

You can turn any amount of expression conditionally, but depends what you mean if this would apply or not.

Mark

pascos88
Contributor

Re: is possible return 2 expression in one if condition?

Maybe I can't because I have just trial Version. I try to be more clarify.

I have 5 expression A B C D E.

If (myVariable=1, Only(A) and Sum(B), if(myVariable=2, Only(C) and Only (D), Sum(E)))

The format of expression look good, but dosn't work

I would to have this solution and use just one bar chart. The dimension is always the same.

I don't know, maybe there is another solution to show 2 expression with a define condition.

nagarjuna_kotha
Valued Contributor II

Re: is possible return 2 expression in one if condition?

Could you share sample data ?

And also explain little bit more.

pascos88
Contributor

Re: is possible return 2 expression in one if condition?

I want use one bar char that change the expression inside when change the variable selected.

Immagine2.png

I have this two chart and the variable that I use are the boton up (Mwh, Revenue, Opex etc)

I would like have  just the first chart, that change dynamically the expression inside.

If MWh is selected my expression will be Production and P50 Product; if I select the variable Revenue, my expression should change in Revenue and Revenue BGT.

I need to insert some condition in expression that return me two condition.

I hope that is more easy to understand in this way

MVP
MVP

Re: is possible return 2 expression in one if condition?

If condition is true, you have x and y. Do you want them to be added ?

pascos88
Contributor

Re: is possible return 2 expression in one if condition?

Yes, where x e y are 2 Expression

Not applicable

Re: is possible return 2 expression in one if condition?

Hi Pasquale,

Exactly i don't no ,but may be helpful for you

sample:

load * inline [

dim,A,B,C,D,E

a,1,2,3,4,5

b,9,8,7,5,6

];

When click a in dim

Untitled.png

when click b in dim

Untitled.png

Re: is possible return 2 expression in one if condition?

Hi,

If you want to conacatenate output of two expression

then try like

If (myVariable=1, Only(A) &' : ' & Sum(B), if(myVariable=2, Only(C) & ' : ' & Only (D), Sum(E)))

Regards

Regards,
Prashant Sangle
Community Browser