Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
livetolearn
Contributor
Contributor

Dimension based on selection

Hi All, 

I just wanted to know how do i  change the dimension of a table or bar chart , 

Example : I have a bar chart  with dimesion "Region"  and expression as Sum(Sales) . 

Now I want to have a list box as variable in (0 and 1) if I select 1 then the table should show Dimesnion as "Country" 

and If 0 then the table chart should show "Region ".

Is this possible to make the table or bar chart change the dimesions according to the selection from the list box ?

 

Thanks

1 Solution

Accepted Solutions
MayilVahanan

Hi @livetolearn 

Create a listbox using inline or create dropdown list box.

Load * inline

[

UserInput

1

0

];

and make it "Always one selected value".

In dim expression,

=If(UserInput = 1, Country, Region)

--

Label: =If(UserInput = 1, 'Country', 'Region')

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

3 Replies
MayilVahanan

Hi @livetolearn 

Try like below

=If(vUserInput = 1, Country, Region)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
livetolearn
Contributor
Contributor
Author

@MayilVahanan  

I created the variable vUserInput and in definition I assigned one , 

And in the dimension  i mention your above mentioned expression , 

But the thing is how do i make the selection 1 or now selection in a list box ? 

And also the header of the dimesion should change  if its Region or Country ? 

I am stuck on this 

MayilVahanan

Hi @livetolearn 

Create a listbox using inline or create dropdown list box.

Load * inline

[

UserInput

1

0

];

and make it "Always one selected value".

In dim expression,

=If(UserInput = 1, Country, Region)

--

Label: =If(UserInput = 1, 'Country', 'Region')

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.