Qlik Community

Qlik Sense Enterprise Documents

Documents for Qlik Sense related information.

Cycle dimensions using a variable button or dropdown

richbyard
New Contributor III

Cycle dimensions using a variable button or dropdown

Cycle dimensions that change multiple objects with one selection have been a powerful tool in Qlik visualisations and dashboards. Whilst this has not quite made it into the product there is a very simple workaround that enables you to get all of your charts dynamically changing. This can used for both dimensions and measures (see this link for an example using measures).

Here's a quick example (plays 2 times)

cycle-dimension.gif


Steps to implement

> Download and install the QSVariable extension from Branch (or see attached for the version at the time of writing).

> To create a cyclic dimension:

Capture.PNG

1. Specify a variable name. If you have not already created this variable it will create it in the application.

2. Select Button or Select (dropdown) in the 'Render as' option. You can also experiment with the style and width setting to get different effects.

3. Click 'Add Alternative'

4. Enter in the Value and the Label for the option you want to setup. The 'Value' will be passed into the variable and so this should match your fieldname identically (i.e. case sensitive and use square brackets where there is a space in your fieldname e.g. [Customer Name])

5. Repeat steps 3 and 4 for each additional option you wish to show and switch between.

6. Enter the default value for the variable so that a selection is always made on open.

     a. In the Edit sheet window, click on the following button in the bottom left.

Variable.JPG

     b. In the Variable window that pops up, click on the edit icon of the variable you wish to update.

Variable1.JPG

c. Enter the Value that will be the default value for your variable. Ensure that it is one of the values that you have entered in the variable extension object. When done click on the edit button again to save and close the window.

Variable2.JPG

7. Create a dimension in your master items (or reference directly in each chart) using the variable reference as $(VariableName).

Known Limitations

> We are unable to dynamically label dimensions and measures at this stage (as of writing after release of v3.1). As such you have generic naming of the dynamic field.

See the attached example for more details or comment below.

Thanks

Attachments
Comments
gferran
New Contributor III

Elegant and easy to implement. Thanks for sharing.

markcurry
Visitor

Really helpful, thanks a million!

paulyeo11
Valued Contributor II

Hi All

Thank you this is useful. But Step 6  , i not sure how to do it , can some one share with me how ?

Paul

richbyard
New Contributor III

Hi Paul, I have added a few steps in under point 6 to show you how to do this part.

Richard

tinaco110
Contributor III

Fantastic Extension

Not applicable

Hi Richard, I just could not thank you enough

prananellutla
Contributor

Hi Richard,thankyou for the extension , it is very clean and decent. I have an issue though not sure what is wrong,I have defined a variable for dimension and measure.when i define  those variables in the chart I dont see any data , its  al l blank when i create the variable.I created a variable following your steps. .I assumed it is because of the chart extension iam using ?amcombo.but then i tested it with basin bar chart and still shows no data. can you please advise? thanks Prana

img2.jpgimg1.jpg

richbyard
New Contributor III

In the value area f the variable extension, where you are setting the different selection options, you are including an '=' sign. This should not be there. Remove this and it should work (you may also need to do this to your default variable value).


Thanks
Richard

prananellutla
Contributor

Thankyou Very Much Richard, it works

2  more qns ,

1) If I want to see 1 dimension and 2 measure is multi select an option on the measures?how can I do it

It works fine when I use data items with no spaces (POC,Area).If I use the fields which have spaces it is not working. (Field History). my variable definition is ,va1.jpg

ex1.jpg

richbyard
New Contributor III

1) you would need to have two variable objects controlling two variable values for the two measures. There is no way to multi select through this option.

2) enclose the field name with spaces in square brackets, i.e. [field name], in the value field of the variable object and as the default value you enter into the variable window.

Version history
Revision #:
1 of 1
Last update:
‎09-22-2016 06:51 AM
Updated by: