Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
shempgracie
Contributor III
Contributor III

Set expression with multiple filters and a variable not working

Hi All,

I have a scatter plot and I want the user to be able to pick 2 points from the scatter plot, and then have 2 pie charts reflect the market share of each point that was selected (so they can compare market share at point 1 vs market share at point 2).

I have a variable that grabs the point that was selected from the scatter plot (it's called PICK2).

When I use the below expression, and hard code the PLAN that was selected, it works.  When I use the variable, it does not.

Does anyone know how to convert this to use my variable instead of hardcoding it?

This works with hardcoding:

avg({<myFilter1=$::myFilter1, myFilter2=$::myFilter2, PlanName={'Acme Plan'} >}MarketSharePercent)

This does not work with my variable:

avg({<myFilter1=$::myFilter1, myFilter2=$::myFilter2, PlanName=$(Pick2) >}MarketSharePercent)

 

Thank you in advance!

MNike

Labels (1)
9 Replies
Vegar
MVP
MVP

It should work.
You need to make sure that the output of $(Pick2) is {'Acme Plan'} and not only 'Acme Plan'.
sunny_talwar

May be try this

Avg({<myFilter1=$::myFilter1, myFilter2=$::myFilter2, PlanName = {'$(Pick2)'} >} MarketSharePercent)
shempgracie
Contributor III
Contributor III
Author

Ok that may be my problem.  Right now Pick2 is:   Acme Plan.

How can I get my variable to format as {'Acme Plan'}, or how can I change my set expression to handle that?

 

Thank you!

Mike

 

shempgracie
Contributor III
Contributor III
Author

I tried this, but unfortunately my pie chart was still blank.

Any other thoughts?

Mike

Vegar
MVP
MVP

vPick2 = '{'& Concat(DISTINCT Chr(39) & Pick2 & Chr(39), ', ') & '}';

shempgracie
Contributor III
Contributor III
Author

Ok I think we're getting closer! I formatted my variable the way you described.  Now its like this:

Pick2 = {'Acme'}

This continues to work when hardcoded, but still doesn't work with the Pick2 variable.

avg({<myFilter1=$::myFilter1, myFilter2=$::myFilter2, PlanName={'Acme'} >}MarketSharePercent)

I've tried every combination of PlanName=Pick2, PlanName=$(Pick2), etc. and my pie chart is still blank.

Any other ideas what I'm doing wrong?

Mike

 

 

shempgracie
Contributor III
Contributor III
Author

...and a little more info that may help:

 

My Pick2 variable now looks like this:

Pick2='{'& Concat(DISTINCT Chr(39) & SubField(GetFieldSelections(PlanName),',',2) & Chr(39), ', ') & '}';

Any help would be greatly appreciated!

Mike

 

 

Vegar
MVP
MVP

Do I understand correctly that the SET modifier

PlanName=$(Pick2)

should set PlanName to all selected PlanName?

This is default behavior in Qlik Sense. Can't you just use the expression without the PlanName modifier?

avg({<myFilter1=$::myFilter1, myFilter2=$::myFilter2>}MarketSharePercent)

 

sunny_talwar

If this is what it is, why don't you just use this

Avg({<myFilter1=$::myFilter1, myFilter2=$::myFilter2, PlanName = P(PlanName)>}MarketSharePercent)

or this

Avg({<myFilter1=$::myFilter1, myFilter2=$::myFilter2, PlanName = $::PlanName>}MarketSharePercent)