Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
haneeshmarella
Creator II
Creator II

How do I color a dimension consisting two fields with same expression?

Hi, I have a dimension based on the formula

IF(len(trim([CONTAINER]))=0,'OFF-LINE','ON-LINE') as OFF_ON_LINE

The expression for the above dimension is count(distinct case#).

How can I color the cells in straight table such a way that for OFFLINE below 70 is red and above 70 is green, and for ONLINE below 110 is red and above 110 is green?

1 Solution

Accepted Solutions
YoussefBelloum
Champion
Champion

Hi,

did you try using the background color expression section of the dimension ?

using an expression like this:

=if(OFF_ON_LINE='OFF-LINE',

if(count(distinct case#)<70,

red(), if( count(distinct case#)>70, green())),

if(count(distinct case#)<110, red(), if(count(distinct case#)>110, green())))

View solution in original post

10 Replies
YoussefBelloum
Champion
Champion

Hi,

did you try using the background color expression section of the dimension ?

using an expression like this:

=if(OFF_ON_LINE='OFF-LINE',

if(count(distinct case#)<70,

red(), if( count(distinct case#)>70, green())),

if(count(distinct case#)<110, red(), if(count(distinct case#)>110, green())))

vishsaggi
Champion III
Champion III

May be this?

= IF(Count(DISTINCT {< OFF_ON_LINE = {'OFF-LINE'} >} Case#) < 70, Red(),

     Count(DISTINCT {< OFF_ON_LINE = {'OFF-LINE'} >} Case#) > 70, Green(),

     Count(DISTINCT {< OFF_ON_LINE = {'ON-LINE'} >} Case#) < 110, Red(),

     Count(DISTINCT {< OFF_ON_LINE = {'ON-LINE'} >} Case#) > 110, Green())

haneeshmarella
Creator II
Creator II
Author

Converts every cell into red color.

haneeshmarella
Creator II
Creator II
Author

It says error in expression.

YoussefBelloum
Champion
Champion

just check the expression (parentheses...)  this is how you color your cells

vishsaggi
Champion III
Champion III

Can you share your expression you are using and if possible share your qvw file to work on?

haneeshmarella
Creator II
Creator II
Author

Oops my bad, forgot that case# is case sensitive. It works, thanks Youssef.

haneeshmarella
Creator II
Creator II
Author

Thanks for your response Nagaraju, the answer provided by Youssef above worked.

YoussefBelloum
Champion
Champion

You're welcome good luck