Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Not applicable

Conditional Show based on Selection

Hey Everyone-

I know this is super simple, but for some reason I cannot figure this out.  Currently have a straight table:

ClientMetricOutput
JoeRunningHe's super fast
MikeRunningHe's super slow, around 10% Slower
MichelleSwimmingAverage swimmer
JoanBikingAverage at 10%
JohnRunningAverage at best

I have a separate list box called "Client" so they can filter this straight table to the selection.  What, I'd like to do is the following:

If the user clears all and does not select any client, then just show "Mike" (and it's results)

If not, then go by the listbox selection(s)

In my straight table, for "Client" I have changed to the dimension to a calculated dimension, that looks like this:

=if(GetSelectedCount(Client)>=1,Client,Client='Mike')

For the field "Output," since it's straight table (and not a table box), I made that field as an expression using the following:

=Only(Output)

However, if I "Clear All" under "Client" in the straight table, I get -1 instead of it saying "Mike."  The other two fields (Metric and Output) come out correct.

I've literally been racking my brain on this, but for some reason I can't get anything but either -1 or a NULL value instead of just "Mike."

Now, if I do select a specific "Client" under the listbox, everything comes out correct (in other words, it shows the Client's name).  What am I missing?

Thanks!

1 Solution

Accepted Solutions
jason_michaelid
Honored Contributor II

Re: Conditional Show based on Selection

Got it.  INstead of a calculated dimension, just have Client and Metric as normal dimensions, then as your expression:

=IF(GetSelectedCount(Client)=0,Only({<Client={Mike}>} Output),Only(Output))

Hope this helps,

Jason

5 Replies
jason_michaelid
Honored Contributor II

Re: Conditional Show based on Selection

Can you post your sample app?

Highlighted
Not applicable

Re: Conditional Show based on Selection

Hey Jason-

Here you go:

jason_michaelid
Honored Contributor II

Re: Conditional Show based on Selection

Got it.  INstead of a calculated dimension, just have Client and Metric as normal dimensions, then as your expression:

=IF(GetSelectedCount(Client)=0,Only({<Client={Mike}>} Output),Only(Output))

Hope this helps,

Jason

vaibsonly
Contributor II

Re: Conditional Show based on Selection

hey u can simply use d following expression

=if(GetSelectedCount(Client)=0,'Mike',Client)

Not applicable

Re: Conditional Show based on Selection

Thanks so much Jason.  I knew it was something simple.  This works perfectly!

Community Browser