Qlik Community

Ask a Question

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Join us March 10th, 7 Ways Modern Analytics Can Help You Take Smarter Action. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vercammenqlik
Partner
Partner

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

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')

View solution in original post

vercammenqlik
Partner
Partner

Thanks Sunny!