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: 
nituverma097
Contributor III
Contributor III

Dimension Variables with Measures Variables Button.

Hi ,

I have one table where I can put the measure  MTD and YTD on the selected button (find Screenshot)and have a state as a dimension. But the user wants selection on the dimension for example if the user wants to see MTD/YTD according to region, then the user wants a similar button like the MTD and YTD for selection Region and category. He wants when the select region, Region come replace of State, If the user clicks on Category region replace with category.  How I can write the condition on it. Currently, I am using this Condition

=IF($(Show)=0 ,Sum({<[Order Date]={">=$(=(MonthStart(Max([Order Date]))))<=$(=Max([Order Date]))"}>} Sales),

Sum({<[Order Date]={">=$(=(YearStart(Max([Order Date]))))<=$(=Max([Order Date]))"}>} Sales))

 

nituverma097_0-1592728083538.png

 

 

 

 

 

1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

In the button properties, where you are setting the value of the variable, you need to put Category into single quotes:

='Category'

That will put the word category into the variable, whereas without quotes it will look for the field called Category and get the result from here. With only one Category selected it will be the name of the category, with many it will return null.

Hope that helps.

Steve

View solution in original post

9 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

Hi,

I assume you are using the Variable button object from Qlik Dashboard bundle.

You can define values for each option in the dropdown. These values can be the names of the dimension fields.

Then, in the table, you put this expression for the dimension:

=[$(vDim)]

Replace vDim with the name of the variable you used in the Category/Region dropdown

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

I've a Sense app where a list of dimensions is loaded from a spreadsheet and these can then be used in a drop down to pick dimensions for tables and charts. This video shows how it works:

You can download the app from here: https://www.quickintelligence.co.uk/isa

I'm also just putting the finishing touches on a blog post which describes how it is put together, my blog is here:
https://www.quickintelligence.co.uk/blog/

The post about the Instant Sense Application should be up in the next day or so. In the mean time this blog may prove useful: https://community.qlik.com/t5/Qlik-Sense-Documents-Videos/Create-a-Cycle-Group-in-Qlik-Sense-without...

Hope that helps.

Steve

nituverma097
Contributor III
Contributor III
Author

Hi Fosuzuki,

Thank you for your revert. But I am not able to do this. It gives an error. Can you please explain your answer with an example, it will be good for me. Please help me where I am going wrong.

 

 

nituverma097_0-1592805861587.png

 

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

In the button properties, where you are setting the value of the variable, you need to put Category into single quotes:

='Category'

That will put the word category into the variable, whereas without quotes it will look for the field called Category and get the result from here. With only one Category selected it will be the name of the category, with many it will return null.

Hope that helps.

Steve

nituverma097
Contributor III
Contributor III
Author

Thank you Stevedark for the solution. 

nituverma097
Contributor III
Contributor III
Author

Hi,

 

How can I get the dynamic title. For example if choose category (Select from button) then in dimension title show category, if select region then dimension title shows "Region" as a title.

Like this (find screenshot below.)

Please help me .

 

 

 

 

nituverma097_1-1596114478216.png

 

 

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

If you are placing either Region or Category as text into a variable you can set the button legend by using an expression like this:

='$(vDimension)'

The syntax for getting the content of a variable is called Dollar Sign Expansion, and if you Google this you should find a lot more information on how the syntax works. 

nituverma097
Contributor III
Contributor III
Author

Thank you all for supporting and help me to get all the solutions.

I am again stuck in one problem again.  I have made variable button on multiple dimensions . It's working fine. But when logout , the chart shows me "Invalid visualization".  How to get one selected value (Dimension) every time automatically to avoid this situation.   In the variable drop down its deselect the dimension automatically.  Please help me.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @nituverma097 

There are two approaches here. In more recent releases there is a Only One Selected option on Master Dimensions, this may deliver what you want. The other approach is to always take the first sorted value, even when there are multiple (or none) selected items.

To do the later you will want something like =minstring(Dimension) in the vDimension variable, rather than just the dimension name (which will be null if there are multiple values).

The app that I reference above does this, but slightly better, as it assigns each dimension a number and returns the lowest numbered dimension.

Hope that helps,

Steve