Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to dynamically hide and enable a measure or dimension in chart

Hi ,

Sorry to ask to many basic questions. haven't gone through the training..

In qlikview we can dynamically hide and enable expression and dimension in the chart with button action or listbox selection. How can i do the same in Qliksense. i know we cannot create variables and buttons. Is there any better approach and also it would be more helpful if anyone shares any sample document. Can we conditionally hide and enable a object in Qlik sense.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

One of my colleague helped me on this. Wanted to post because there could be people like me...

Modify your script like this:

Define a table with the field names that you wish to select for your chart (it can be an inline table or any other type of table.)

Set HidePrefix accordingly

Create a variable to hold the Current Primary Dimension.  (It will only have a value if a value is selected.)

SET HidePrefix='_' ;

PrimaryDimension:

Load * Inline [

_PrimaryDimension

Division

Invoice Year

];

LET vCurrentPrimaryDimension = '=$(GetCurrentField(_PrimaryDimension))';

Modify your GUI like this:

Add a listbox

Set the Field function as:

=[_PrimaryDimension]

Title value as:

Select Dimension

Add a Chart:

Define the Dimension of your Chart to be:

Field function:

=[$(=_PrimaryDimension)]

Label

(leave it blank)  Unfortunately, the label does not allow a function, so it cannot be variable

Set the Title of your chart to be:

='$(=_PrimaryDimension)'

(Optional) And the Footnote of your chart to be:

='$(=_PrimaryDimension)'

And i don't the answer whether we can hide and enable a chart.

View solution in original post

9 Replies
sunny_talwar

May be create an Inline table and control the dimensions based on the inline table dimension using GetFieldSelections()

Anonymous
Not applicable
Author

That is a good idea.i will try that and let you know. One more thing we cannot hide and enable charts in Qlik sense? Do we

Anonymous
Not applicable
Author

One of my colleague helped me on this. Wanted to post because there could be people like me...

Modify your script like this:

Define a table with the field names that you wish to select for your chart (it can be an inline table or any other type of table.)

Set HidePrefix accordingly

Create a variable to hold the Current Primary Dimension.  (It will only have a value if a value is selected.)

SET HidePrefix='_' ;

PrimaryDimension:

Load * Inline [

_PrimaryDimension

Division

Invoice Year

];

LET vCurrentPrimaryDimension = '=$(GetCurrentField(_PrimaryDimension))';

Modify your GUI like this:

Add a listbox

Set the Field function as:

=[_PrimaryDimension]

Title value as:

Select Dimension

Add a Chart:

Define the Dimension of your Chart to be:

Field function:

=[$(=_PrimaryDimension)]

Label

(leave it blank)  Unfortunately, the label does not allow a function, so it cannot be variable

Set the Title of your chart to be:

='$(=_PrimaryDimension)'

(Optional) And the Footnote of your chart to be:

='$(=_PrimaryDimension)'

And i don't the answer whether we can hide and enable a chart.

Anonymous
Not applicable
Author

Yaar Sunny do you know how to define that Getfeildselections in the front end in the dimension.

sunny_talwar

Kya matlab Vinay bhai? Can you share an example of what you trying to do?

Anonymous
Not applicable
Author

Sunny the solution which i have provided above is working but the label is showing a variable name not the selected field name. But i want to try your GetFieldSelections() option too.. for example in the script i have defined the inline table as below:

PrimaryDimension:

Load * Inline [

_PrimaryDimension

DIVISION_NAME

SalesRepName

Sales Channel

Delivery State

OCUSMA State

];

when i take the _PrimaryDimension in the filter pane. And now i want the same field to be displayed in the chart too..Let me know if that makes sense. otherwise i will post you in some more detail.

phaneendra_kunc
Partner - Specialist III
Partner - Specialist III

one thing you wont have with this approach is "Always One selected" if user doesnt pick anything you will error in the chart.

i am using an list box extension for my on the fly metrics/dimension selections.

Qlik Sense List Box Extension

sunny_talwar

Well, the idea you have below is what I wanted to propose also. GetFieldSelections was an idea to restrict measures and dimensions. But I have very limited knowledge of how to do it in Qlik Sense. I guess Phani might be able to shed more light on that

Anonymous
Not applicable
Author

Hey super raa...