Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
davyqliks
Specialist
Specialist

Count if statement with rgb colour in map

Hi,

Trying to use the map feature in QS and colour by measure based on a count.

The layer is using a country field and trying to colour by measure using if like this.

=if(Count(Distinct{<[Standard]={'0','1','2','3'}>}[Standard]),RGB(204,101,118))
=if(Count(Distinct{<[Standard]={'4','5'}>}[Standard]),RGB(220,204,119) )
=if(Count(Distinct{<[Standard]={'6','7'}>}[Standard]),RGB(97,166,102)

 

first issue is how to link the if statements and the biggest is even when using the top 2 lines (with no error) i am getting no colour return

Any ideas please?

Thankyou in advance

DavyQliks

Labels (4)
1 Solution

Accepted Solutions
sonkumamon
Creator
Creator

Sorry, I forgot to close the first expression with brackets. Hope this expression will work:

=if(Count(Distinct [Standard]) >=0 and Count(Distinct [Standard]) <4 ,RGB(204,101,118),
if(Count(Distinct [Standard]) >3 and Count(Distinct [Standard]) <6 ,RGB(220,204,119),
if(Count(Distinct [Standard]) >5 and Count(Distinct [Standard]) <8,RGB(97,166,102))))

Just play with the brackets a bit. 

View solution in original post

6 Replies
sonkumamon
Creator
Creator

I don't think that will work with the approach you are taking, try using the following:

=if(Count(Distinct [Standard] >=0 and Count(Distinct [Standard]) <4 ,RGB(204,101,118),
if(Count(Distinct [Standard] >3 and Count(Distinct [Standard]) <6 ,RGB(220,204,119),
if(Count(Distinct [Standard] >5 and Count(Distinct [Standard]) <8,RGB(97,166,102))))

davyqliks
Specialist
Specialist
Author

Hi,

Thanks for the reply, i have tried to add to the colour measure and get the following:

davyqliks_0-1612260948138.png

 

any ides? thank you so much

DQ

 

sonkumamon
Creator
Creator

Hi,

I cannot see what's wrong or an error, can you elaborate?

davyqliks
Specialist
Specialist
Author

Thanks Again @sonkumamon 

Here is the expression in the 

davyqliks_0-1612263709742.png

and the error:

davyqliks_2-1612263773412.png

I have tried to correct and cannot see where the error is to correct it but i am getting no colour returns on the map. Apologies, your help is much appreciated.

thank you

 

 

 

 

sonkumamon
Creator
Creator

Sorry, I forgot to close the first expression with brackets. Hope this expression will work:

=if(Count(Distinct [Standard]) >=0 and Count(Distinct [Standard]) <4 ,RGB(204,101,118),
if(Count(Distinct [Standard]) >3 and Count(Distinct [Standard]) <6 ,RGB(220,204,119),
if(Count(Distinct [Standard]) >5 and Count(Distinct [Standard]) <8,RGB(97,166,102))))

Just play with the brackets a bit. 

davyqliks
Specialist
Specialist
Author

PLease dont apologies, you helped me out loads here.

Thank you so much

 

DQ