Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sprutskih
Contributor
Contributor

Filter pane expression in dimension (multiple select)

Hello!

 

I have a table like this

 

 

fruit1red,blue
fruit2blue
fruit3brown
fruit4brown,red
fruit5red,white

 

I need to create filter pane with this fields:

blue

red

white

etc...

 

And if I select "red" on filter pane, i will select all fields where red presented (the same with other colors)

I tried 

=IF (SubStringCount(Upper([ir_type]), 'RED') > 0, 'Red',

IF (SubStringCount(Upper([ir_type]), 'BROWN') > 0, 'Brown',

IF (SubStringCount(Upper([ir_type]), 'WHITE') > 0, 'WHITE

....

 

But this construction work not correctly because of each next IF located in ELSE statement of previous IF

and in the last IF I will get only rows, that not come to any other statement part.

 

I use SubStringCount(Upper([ir_type]), 'BROWN' because of colors it is just example and actially I have field in dictionary inside.

 

Please, tell me the right way of create filter like this?

 

 

6 Replies
Vegar
MVP
MVP

I would recommend you to separate the list into unique dimension record in the script. Like below.

fruit1red
fruit1blue
fruit2blue
fruit3brown
fruit4brown
fruit4red
fruit5red
fruit5white 
Steven_Haught
Creator III
Creator III

In your load, add a field for this:

trim(Subfield(ColorField, ',' )) as NewColor

Then, set NewColor as Dimension in the filter pane. 

sprutskih
Contributor
Contributor
Author

In both this case, I will get a lot of duplicates of objects in my table.

In my case for all visualizations it is very important to have one object in one string.

 

I will get strings that will be different just by one field (ColorField in this case). Could you please tell me, how to aggregate all duplicates for other visualizations?

 

 
Steven_Haught
Creator III
Creator III

Don't git rid of the original color field. Load the Original color field. Then directly below it add the above string to create a new field. Do not put the new field in your table, just in the filter pane. Put the original color field in table. It will filter it correctly. 

Steven_Haught_0-1596540105891.png

 

sprutskih
Contributor
Contributor
Author

trim(Subfield(ColorField, ',' )) as NewColor - yes, I add this string to load script, finally I get table with both ColorField and NewColor fields:

FruitNameColorFieldNewColor
fruit1red,bluered
fruit1red,blueblue
fruit2blueblue
fruit3brownbrown
fruit4brown,redbrown
fruit4brown,redred
fruit5red,whitered
fruit5red,whitewhite

 

Instead 5 row in my table I get 8 rows.

in this case in any visualization if I set Count(FruitName) in Dimension I will get 8 (wrong number of actual rows).

Is it possible some how to solve this issue for visualization? may be some group?

Steven_Haught
Creator III
Creator III

Your original question stated you wanted this in a filter pane. A filter pane is a separate chart. See my image above. If you are needing to count Fruit as the dimension you would use Count( Distinct FruitName). If you are trying to do a count of fruit where color includes red it would be Count(distinct{<NewColor={'red'}>}FruitName)