Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Different color shades between only two color depending on number of rows and Values in the cell

Hi All,I have a requirement where I have to color the cell in different shades between two colors (say red and blue) based on the cell value and number of color shades also depend on no of rows like in the below image.

Color.JPG

is there any way to achieve this ?

16 Replies
sunny_talwar

John that's the reason I still don't know how to use this. I just know it do some kind of color coding, but how it works it a mystery for me. I have to spend some time to understand some of the functionality such as Hierarchy, ColorMix.

ziabobaz
Creator III

I am sorry, I have similar question. I use Sense though..

I have a Table with a Calculated Measure column, where a resulting value is from 0% to 100%.

1. Can i color code the cells based on their values? From Red (0%) to Green (100%), with a Yellow (50%) in the middle?

2. And, alternatively, Red would me the minimum of the selected, and Green for maximum of the selected.

Thank you!

sunny_talwar

What is your expression?

ziabobaz
Creator III

I was trying to use colormix1

ColorMix1([FIELDNAME], RED(),GREEN())

But it won't allow me to use FILEDNAME, only the integer (from 0 to 1)

johnw
Champion III

Assuming the functions work the same in QlikSense, you'd need colormix2() instead of colormix1(). Colormix2() requires a value from -1 to +1 and three colors. So you want an expression that maps your minimum selected value to-1, and your maximum to +1. I believe this should do the trick.

colormix2(2*([FIELDNAME]-min(total [FIELDNAME]))/(max(total [FIELDNAME])-min(total [FIELDNAME]))-1,red(),green(),yellow())

ziabobaz
Creator III

it says "invalid FIELDNAME"

My FIELDNAME is a calculated dimension, I assume that is the reason

Unfortunately I can't calculate this field in Load Script because it involves set analysis

ziabobaz
Creator III

I think i found a workaround of using a calculated field inside calculated field (or in a background formula).

I created a variable with the same formula as calculated field.

then a added this formula in the color box:

colormix1($(vSelloutPeriod),red(),green())

it worked!