Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have defined a palatte of nine colours which I want to use in a bar chart.
I added the following lines in my "Main" Data Editor sheet:
SET kBlue = ‘=rgb(77,119,171)';
SET kBlueLight = ‘=rgb(55,164,208)';
SET kBlueDark = ‘=rgb(47, 48, 82)';
SET kPurple = ‘=rgb(98, 52, 127)';
SET kGrey = ‘=rgb(96, 96, 92)';
SET kGeen = ‘=rgb(78, 175, 69)';
SET kYellow = ‘=rgb(245, 187, 37)';
SET kRed = ‘=rgb(217, 34, 64)';
SET kBlack = ‘=rgb(3, 3, 3)';
Now, if I want to use the "colour by expression" function on my bar chart and type the following:
IF(Sum([Diff x Amount])/Sum([Amount in Euro])<20,kRed,
if(Sum([Diff x Amount])/Sum([Amount in Euro])<30, kYellow,
if(Sum([Diff x Amount])/Sum([Amount in Euro])<40, kGreen,
if(Sum([Diff x Amount])/Sum([Amount in Euro])<50, kYellow,
kRed
))))
QlikSense throws an "invalid field name" error. If I replace the bold colours with "standard colours" like red() it works.
What am I doing wrong?
Thanks!
ps. side note:
Is it possible to use master measures in expressions?
If you use variables that start with an equals sign, and dollar expansions, they will be recalculated every time you click. This is unnecessary. Instead, you could use numerical values of the colors. So, use a Let statement instead of a Set statement:
Let kBlue = Num(rgb(77,119,171));
Then your expression will work.
HIC
Hi!
kRed -> $(kRed)
If you use variables that start with an equals sign, and dollar expansions, they will be recalculated every time you click. This is unnecessary. Instead, you could use numerical values of the colors. So, use a Let statement instead of a Set statement:
Let kBlue = Num(rgb(77,119,171));
Then your expression will work.
HIC
thanks guys
Use LEt and Num ie....
LET kBlue = Num(rgb(77,119,171));
LET kBlueLight = Num(rgb(55,164,208))';
LET kBlueDark = Num(rgb(47, 48, 82))';
LET kPurple = Num(rgb(98, 52, 127));
LET kGrey = Num(rgb(96, 96, 92));
LET kGeen = Num(rgb(78, 175, 69));
LET kYellow = Num(rgb(245, 187, 37));
LET kRed = Num(rgb(217, 34, 64));
LET kBlack = Num(rgb(3, 3, 3));