Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Toggle field for bar chart?

New user, so if this is a redundant questions, I apologize in advance.

My company uses approx 10 metrics to evaluate performance. So far, the tool seems to do what we need it to do. My demo app I am building is hardcoded to a single metric at the moment. How would I go about adding the equivalent of a dropdown box or button for the user to select the metric to display in the graph?

Example graph shows score by day of week. I would like the users to select whether they are looking at the customer satisfaction metric, the call center metric, project timeliness etc. Pivot remains the same, but the field in the table being averaged would change, along with the labels. If I have to make 10 different graphs all on the same tab and hide 9 of them off a user click, I am ok with that. A single graph that hides 9 of the 10 values would be even better.

Thank you.

-Joel

6 Replies
Not applicable
Author

There are probably a few ways to handle this. You could make separate graphs with Conditional Shows. The selection box could be populated using an inline load and then whatever they select in that field would trigger a variable associated with the Conditional Shows.

You could also just make the expression (is that the piece that changes on each graph?) a variable: =$(vVariable). Then depending on which item is selected you could set the value of that variable to the appropriate expression.

If you do an Inline Load with each Metric Name along with a Metric Expression, you could set the variable to =ONLY(MetricExpression) and then for whatever metric they select, the appropriate expression will appear.

Yet another option is to Group expressions in the chart. The user can then cycle through the different expressions using QlikView's built in functionality.

Not applicable
Author

I like the idea of the conditional show I think. I went into the document properties and created a blank variable called "vMetricType" in the variable tab.

I created two buttons,

button1 > Actions > Set Variable > Variable vMetricType > value 'metric1'

button2 > Actions > Set Variable > Variable vMetricType > value 'metric2'

Selecting the buttons shows the proper values in Settings >Variable Overview

On chart1 > Layout > Conditional > vMetricType='metric1'

On chart2 > Layout > Conditional > vMetricType='metric2'

Both charts instantly disappear, clicking the buttons has no effect. Do I need to enter the conditional statement in a different way, or add some additional action to the button?

Thanks for your help.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It looks about right. When you specified the value in the Action, you did not use quotes, correct?

Can you post a copy of the qvw with the failing bit?

-Rob

Not applicable
Author

I tried with both double and single quotes. Here is an attachment of a sample project trying to prove the point. shift + ctrl + s seems to be a handy thing...

Thanks for the help.

As an aside, why when I add new buttons to the page are they disabled? I have to set the first action of the button to enable itself. It didn't seem to be happening earlier today, did I accidentally make a wayward click?

Not applicable
Author

Rob was right, it was quotes. You don't want quotes in your Set Variable action. If you look at the Variable Overview, you will see the quotes were being added to the variable value. Also, in your Conditional Show, you want single quotes instead of doubles.

I think new buttons are disabled until you add an action. That is the behavior I have been seeing in v9.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The value in the Action should use no quotes. The conditional expression should use single quotes. See attached.

It's normal that a button with no Action is disabled.

-Rob