Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have a table like this
fruit1 | red,blue |
fruit2 | blue |
fruit3 | brown |
fruit4 | brown,red |
fruit5 | red,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?
I would recommend you to separate the list into unique dimension record in the script. Like below.
fruit1 | red |
fruit1 | blue |
fruit2 | blue |
fruit3 | brown |
fruit4 | brown |
fruit4 | red |
fruit5 | red |
fruit5 | white |
In your load, add a field for this:
trim(Subfield(ColorField, ',' )) as NewColor
Then, set NewColor as Dimension in the filter pane.
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?
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.
trim(Subfield(ColorField, ',' )) as NewColor - yes, I add this string to load script, finally I get table with both ColorField and NewColor fields:
FruitName | ColorField | NewColor |
fruit1 | red,blue | red |
fruit1 | red,blue | blue |
fruit2 | blue | blue |
fruit3 | brown | brown |
fruit4 | brown,red | brown |
fruit4 | brown,red | red |
fruit5 | red,white | red |
fruit5 | red,white | white |
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?
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)