Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sagar082
Creator
Creator

How to change dimensions on the bases of variable selection

Hi Everyone,

Greeting for the day. I need help to change dimension of pie chart on the bases of user selection which is capturing in variable.

Variable has value; value 1 and value 2. I'm looking something like;

If(wildmatch($vVariable) = value1, value2), field 1, field 2)

At present the above expression return only field 1.

Both field has two levels.

Regards,

Sagar 

 

1 Solution

Accepted Solutions
Sagar082
Creator
Creator
Author

Hi,

Greeting for the day. Thank you for reply and your valuable time.

I found solution, by using your suggestion and modifying my existing formula as,

If(wildmatch('($vVariable') = '*value1*', '*value2*'), field 1, field 2)

View solution in original post

5 Replies
MayilVahanan

Hi @Sagar082 

Try like below

If($(vVariable) = 'value1', field 1, field 2)

or

Pick(wildmatch($(vVariable), 'value1', 'value2'), field 1, field 2)

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

Do you need wildchar comparison? Or are the values fixed?

You can do like this:

=pick(WildMatch('$(vVariable)', '*value1*', '*value2*','*value3*'), 'field 1', 'field 2', 'field 3')

or like this without wildchar comparison

=pick(Match('$(vVariable)', 'value1', 'value2', 'value3'), 'field 1', 'field 2',, 'value3')

The benefit of pickmatch over if is that you dont need an nested expression when you have many fields to choose from.

Sagar082
Creator
Creator
Author

Hi,

Thank you for reply. But non of the above is working.

Sagar082
Creator
Creator
Author

Hi,

Greeting for the day. Thank you for reply and your valuable time.

I found solution, by using your suggestion and modifying my existing formula as,

If(wildmatch('($vVariable') = '*value1*', '*value2*'), field 1, field 2)

Sagar082
Creator
Creator
Author

Hi Vegar,

Greeting for the day. Pick function works when position is defined and not useful for matching.

If my condition would result into number then I could have used the pick.

Still many thank as your suggestions help me to direct my thoughts