Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I would like to color code the background of the dimension values in a straight table, somewhat like the "strip every" function but for every new value. With the following example table;
Dimension1 | Dimension2 | Expression |
---|---|---|
A | 1 | |
A | 2 | |
A | 3 | |
B | 1 | |
B | 2 | |
C | 1 | |
D | 1 | |
D | 2 | |
D | 3 | |
D | 4 |
I would like the background color of Dimension1 to be grey for the values A, white for B, grey for C, white for D and so on.
Is this possible? I have tried with the above() function but that doesn't seems to do the trick. The values of Dimension1 in the real data is not as simple as A-Z.
You can click on the '+' symbol next to your dimension and there under 'background' option, you can write a if statement to derive the color you want.
I hope this helps.
Hi,
This should do the trick :
Background Color expression for Dimension1 :
=if(even(aggr(NODISTINCT rowno(),Dimension1)),rgb(180,180,180),white())
Regards,
Thomas
Yea, I know how to change the background color of the cell - the question I asked was how to give the the Dimension1 value A and C the same bg color, and B and D another bgcolor.
We're getting close, thanks Thomas. However it looks like i need to combine some sort of sort with the aggr() function, as of now the first set of dimension1 values in the straight table doesn't get the number 1, and the second set of values doesn't get the number 2.
Well im my test app the "sort order" is somewhat fucked - i could live with an inverted sort order but not with the an "unknown order".
Attached the test app.
Yea, rowno() seems to use kind of fieldindex values, we cannot sort them.
I've changed my mind, so, last try...
With a variable : vTEST = concat(DISTINCT TOTAL {<Dim2-={"$(=null())"}>} chr(39)&Dim2&chr(39),',') //Need to remove null values, don't know why
and as color expression : =if(even(match(Dim2,$(vTEST))),white(),rgb(200,200,200))
Hope this one will be the good one...
Thomas
Hi Blaise,
There is a function called HSL(Hue,Saturation,lum) where we can pass the values from 0 to 1.
If you are going to generate one unique HSL for each distinct value of Dim1, you can use the value in Background colour.
Here is the sample code that i attached. Please reply back if it works.
Hi Blaise, Please find the attched file and hope it helps very well.