Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Fast swap between average and median?

Hello,

I have 4 bar graphs in a container showing ticket age by month.  Each bar graph is slightly different, but they are all using avg ticket age.  I would also like to show Median ticket age.

Rather than create 4 new tabs in the container, or create a container of containers, I'd like to be able to leave just the 4 charts, and have some kind of variable listbox or slider or something where the only two options are median and average.  Then, if the user selects median, all 4 charts will show median, and if they select average, all 4 charts will show average.

I assume in the bar graph expression I can do something like:

=$(vAvgOrMedian) & (TicketAge)

I just don't know how to go about allowing the user to click for vAvgOrMedian

Thank you!

1 Solution

Accepted Solutions
flyingcheesehea
Contributor II

Re: Fast swap between average and median?

There's a few different ways to handle this:

1) Just use a cyclic expression group - Write another expression that uses the median instead of the mean, and drag one on top of the other. In the chart, you'll see a circular arrow icon that you can click to switch between the two.

2) Make the expressions conditional, so that each one shows based on the value of a variable like vAverageOrMedian. (More on this below.)

3) As other_peoples_shoes said, you can create entirely separate objects and use a conditional show/hide in the Layout tab based on a variable as well.

For both (2) and (3), you can just do something like this:

_AverageOrMedian:

Load _AverageOrMedian Inline[

     _AverageOrMedian

     Average

     Median

];

And then create a list box with the "Always One Selected Value" box on the General tab checked. If you haven't already, be sure to add

Set HidePrefix = '_';

to your script, that'll keep the user from seeing the Average or Median selection in the Current Selections box.

Hope this helps!

Kent

3 Replies
Not applicable

Re: Fast swap between average and median?

One way to handle this is to create the chart twice (or just once, and copy / paste.) Use the Layout tabs to set 'Conditional' to vAvgOrMedian = 'average' and vAvgOrMedian = 'median' respectively.

Then create a text object, select actions, go to 'external', and use 'set variable'. This will allow you to change the variable's value when the text object is clicked on.

flyingcheesehea
Contributor II

Re: Fast swap between average and median?

There's a few different ways to handle this:

1) Just use a cyclic expression group - Write another expression that uses the median instead of the mean, and drag one on top of the other. In the chart, you'll see a circular arrow icon that you can click to switch between the two.

2) Make the expressions conditional, so that each one shows based on the value of a variable like vAverageOrMedian. (More on this below.)

3) As other_peoples_shoes said, you can create entirely separate objects and use a conditional show/hide in the Layout tab based on a variable as well.

For both (2) and (3), you can just do something like this:

_AverageOrMedian:

Load _AverageOrMedian Inline[

     _AverageOrMedian

     Average

     Median

];

And then create a list box with the "Always One Selected Value" box on the General tab checked. If you haven't already, be sure to add

Set HidePrefix = '_';

to your script, that'll keep the user from seeing the Average or Median selection in the Current Selections box.

Hope this helps!

Kent

Not applicable

Re: Fast swap between average and median?

Thank you! I didn't know about the cyclic expression group feature.

Community Browser