Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I've got a stacked bar chart with two dimensions (First, Second) and one measure (Measure).
The chart's second dimension (Second) is specified by an expression and is based on the value of a variable:
fx = if ($(myVar)=1, [DimensionX], [DimensionY])
For the coloration I would like the colors to be based on the value(s) of the active dimension; ie, I need to dynamically color by dimension.
Under the Colors setting I chose Custom > By Dimension and specified the above expression in the Dimension expression box.
This does not work. All of the colors turn to gray!
Some observations from playing around:
Thanks for any suggestions.
It appears that spaces in the names of the fields used as dimensions will break the expression parsing for Color by Dimension using expression.
=if (var=1,DimensionX,DimensionY) //works
=if (var=1,DimensionX foo,DimensionY) // does not
=if (var=1,[DimensionX foo],DimensionY) // does not
=if (var=1,'DimensionX foo',DimensionY) // does not
Hi made some test and the problem comes when fields has an empty space. I couldn't find a solution, a workaround can be:
- renaming the field to remove blank spaces
- create another field based on this one given a non-blank-spaces name
- wait for another community member that gives a solution
I'm pretty sure this used to work properly in previous versions of QlikSense otherwise we'd have experienced this problem long ago. I'll bring it to the attention of Qlik support. Thank you very much for your efforts.
A partial solution (only works in some cases) is to use double quotes around the field names:
=if (var=1,"DimensionX foo",DimensionY)
But it seems to be dependent on the "size" of the dimension.
Ruben, would you be so kind as to tell me what version of QlikSense you tested on? Qlik claims to not see this problem on the latest version. I was using v3.2 SR4.
Hi Steven, I used the september version.
I can't try right now the double quote option.
I've consulted with Qlik support. They've verified that it's a bug in Qlik and has been addressed in the latest version.
Hi,
When I use this "color by expression" feature QlikSense disables the Legends. Is there a way to overcome this issue so that we have the custom colored graphs and the legends stay on.
Regards.