Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
vercammenqlik
Partner - Contributor II
Partner - Contributor II

Qlik sense color countries on map by 'if' expression

Hi,

A sample from my data (full dataset contains all countries of the world). Each row contains a combination of country and animal. Multiple animals can be assigned to one country and one animal can also be in multiple countries.

Country ISO alpha 3 codeAnimal
INDCat
USACat
USADog
GBRCow
GBRDog
NORCat

What I would like to achieve is to color the countries on a map based on whether an animal is in that country. I have created the map based on the Geo dimension 'Country ISO alpha 3 code'. To keep it simple I would like to just create a map that colors countries with cats. To do this I use 'Color by expression' and the expression if(Animal='Cat','red').

Problem: on the map only NOR and IND are colored in red. If you look at the sample data, the USA should also be red.

Thanks,

Benjamin

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Try this

If(SubStringCount(Concat(DISTINCT '|' & animal & '|'), '|Cat|') = 1, 'red')

View solution in original post

2 Replies
sunny_talwar

Try this

If(SubStringCount(Concat(DISTINCT '|' & animal & '|'), '|Cat|') = 1, 'red')

vercammenqlik
Partner - Contributor II
Partner - Contributor II
Author

Thanks Sunny!