Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!

Cycle dimensions using a variable button or dropdown

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
richbyard
Contributor III
Contributor III

Cycle dimensions using a variable button or dropdown

Last Update:

Sep 22, 2016 6:51:35 AM

Updated By:

richbyard

Created date:

Sep 22, 2016 6:51:35 AM

Attachments

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

Comments
prananellutla
Creator
Creator

Hi Richard, I need help again with a calculated dimension i need to show using variables .

I have 2 buttons

Current Vs Prior Year( uses a value 1 in variable definition) and Prior Vs Prior to Prior Year(( uses a value 2 in variable definition)

and i have variable measures based on these button selections.

my dimension also have to change with the selection here.

i am having a problem with the logic.

If user clicks on current vs prior chart has to show current and prior years(2018 and 2017)

if user clicks on prior vs prior to prior year chart dim has to display 2017 and 2016.

=if(VRoyerMetrics='1'and year([Hired Date])>=Year(Today())-1,year([Hired Date]),null())

if(VRoyerMetrics='2'and Year([Hired Date])>= year(today())-2 and Year([Hired Date])<=year(today())-1 ,year([Hired Date]),null()))

can you help me? thanks

Prana

0 Likes
prananellutla
Creator
Creator

Hi Richard, I found the solution. thanks

this should be my dim caluclation

If((Wildmatch(Year([Date]),year(today()),year(today())-1)) and '$(vVariable1)' = 1, Year([Date]),

If((Wildmatch(Year([ Date]),year(today())-1, year(today())-2)) and '$(vVaraible2)' = 2, Year([Date])))

richbyard
Contributor III
Contributor III

Hi Prana,

Apologies for not replying and glad to hear you've found a solution. there are any number of ways you can do this but as long as it works

Cheers

Rich

0 Likes
prananellutla
Creator
Creator

Hi Rich,

I just have an other curious qn on this ---instead of a static label, I would like to show values in a dataitem for the users to select . It should kind of act like a filter but i cant use a filter pan. it has to be this variable button. is it possible? thanks Prana

Untitled.png

0 Likes
ErikWetterberg

Hi,

You can surely have dynamic labels, use the function button to set it up.

Since a few versions back the variable extension also supports having a dynamic list of alternatives, meaning that not only the labels can depend on selection state, but also what alternatives are actually possible.

Erik Wetterberg

http://extendingqlik.upper88.com/

0 Likes
prananellutla
Creator
Creator

Hi Eric, thanks for writing back ))  - I tried the option you are suggesting.

with what you are suggesting I have to use another chart and have a calc dimension to show the list of the values of the data item I am using . if(dataiteml]<>null(),[dataitem])

But that is not what I am looking for - I want to list the values in the data item  on  the variable button itself not on any other visual/chart as a dimension expression so the the user can use the button label  as a filter pane to select the name they would to see the data for.

thanks

0 Likes
paulyeo11
Master
Master

Nice info.

Paul Yeo

Director

TDS Technology (S) P/L

Whatsapp +65 9326 1804

www.tdstech.com<http://www.tdstech.com>

lfholland
Creator
Creator

Very helpful.  thank you for sharing!

mscottiaawg
Contributor
Contributor

Is there a way to handle multiple levels of selections? Say, I want to see a table with a Dimension 1 and Dimension 2, but there are times where Dimension 2 will not be selected. Could the table show measures for Dimension 1 and if Dimension 2 is null, not show Dimension 2?

 

Example I want to see production by Year (Dimension 1), then I may want to see production by State or by Agent as Dimension 2. Dimension 2 is optional.

0 Likes
employe4_2
Contributor III
Contributor III

Hi ,

Very usefull post, thanks!

nonetheless, i'm wondering why each time there is an exemple to share, about some subject about Qlik SENSE, you put example for qlik view ... Why? god why ??

If someone got an example app Q.S remaining somewhere, anywhere, for this extension use case?

I would be thankfull !!

0 Likes
Version history
Last update:
‎2016-09-22 06:51 AM
Updated by: