Qlik Community

Qlik Sense App Development

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

vercammenqlik
New Contributor

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
MVP
MVP

Re: Qlik sense color countries on map by 'if' expression

Try this

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

2 Replies
MVP
MVP

Re: Qlik sense color countries on map by 'if' expression

Try this

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

vercammenqlik
New Contributor

Re: Qlik sense color countries on map by 'if' expression

Thanks Sunny!