Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Color Coding in Dimension based on expression value

Hi All,

I am trying to implement a color coding using the "Background Color" in the dimension. My requirement is to code the dimension value based on the total(expression).

Example:

DimensionExpression=count(ID)Color
A50GREEN
B20YELLOW
C30LIGHT GREEN
D100RED
E80BLUE

I can't directly code if(Dimension = 'D' , RGB(-,-,-) ) because the expression value varies. All I want is the highest should be RED,next BLUE, next GREEN and so on.....

Can anyone please suggest something??

Thanks for your help

1 Solution

Accepted Solutions
sujeetsingh
Master III
Master III

=if(rank(count([Sl. No]))= 1,Blue(),

if(rank(count([Sl. No]))= 2, rgb(255,0,0),

if(rank(count([Sl. No]))= 3, Yellow(), white())))

Add the white() color code at last hope it work..

And please update the discussion with correct  or helpful  answer status,which ever you think and satisfied.

View solution in original post

7 Replies
sujeetsingh
Master III
Master III

Asumme is there are lakhs of record then what will happen i think the dictionary of color will come to end....

try to set some criteria and then easily we can use colors.

Not applicable
Author

Hi Sardar,

I do have thousands of record but the distinct dimension values are less than 10, so if I know how to color code based on my requirement above I would be okay.

Thanks for your reply.

sujeetsingh
Master III
Master III

Hi Yaman,

..

Go to The expression and clik on the + sign of expression....

There go on Background color..

and write this code,,,

=if(rank([Count(ID)])=1,RED(),

if(rank([Count(ID)])=2,Green(),

if(rank([Count(ID)])=3,Yellow(),

if(rank([Count(ID)])=4,White(),Blue()))))

Please set the colors according to your requirement,

Not applicable
Author

Hi Sardar,

Thanks for replying. I actually used the expression below , but its only working for rank 1 and 2. Its not working for rank 3 and above. any idea what could be wrong.

Here is the expression:

=if(rank(count([Sl. No]))= 1,Blue(),

if(rank(count([Sl. No]))= 2, rgb(255,0,0),

if(rank(count([Sl. No]))= 3, Yellow())))

Thanks a lot for your help.

sujeetsingh
Master III
Master III

=if(rank(count([Sl. No]))= 1,Blue(),

if(rank(count([Sl. No]))= 2, rgb(255,0,0),

if(rank(count([Sl. No]))= 3, Yellow(), white())))

Add the white() color code at last hope it work..

And please update the discussion with correct  or helpful  answer status,which ever you think and satisfied.

Not applicable
Author

Thank you Son of Sardar.

sujeetsingh
Master III
Master III

It just like helping one with the faith that when i will be in need some other or same will help mee.

You are welcome.

Can i know from where you are ...?

And Firm you are working with..??

It seems that it is much personal ..but if possible then tell else no issue