Discussion board where members can get started with Qlik Sense.
I would like to show several different values in my line graph. Therefor I want to assign different colors to different lines.
In my coloring expression I would like to change the colors to company colors. However this isn't working.
When coloring is on auto all 3 lines will get different colors, so it should be possible to solve with a formula.
The formula is based upon one dimension with several values.
Variable contains: =getfieldselections(Item) =vRelativeSelections
Thanks is advance.
Go to Solution.
Use your variable as
vRelativeSelections=chr(39)&GetFieldSelections(Item,chr(39)&chr(44)&chr(39)) & chr(39)
Can you post an application?
Did you consider to put the color in your model with a table like
Have you thought of making your dimension a master item and setting the colour in there? That way you can apply it consistantly across visualizations in your app.
Then I have a limited amount of colors instead of unlimited.
Yes, but then the dimension would have one color and I want every value to have a different one. Since the dimension has several values.
You can use an index in the color column and color(index) in the expression
Beside the fact that there is a slight syntax-error by missing an closing brackets for match() and one too much for the pick() your variable needs to return the same structure as if you would write this manually like:
pick(match(Item, 'Item1', 'Item2', 'Item3'),red(),Yellow(),black())
which your getfieldselections() don't return because the list-values won't be quoted. This meant you need to use a different approach for example:
pick(match(Item, '$(=concat(distinct Item, chr(39) & chr(44) & chr(39)))'), red(),Yellow(),black())
Further I suggest to apply this kind of color-assignment within the script like: Colors in charts.
Your solution works! only one minor detail, mistake from my side at the beginning:
one more) after the variable and one less at the end!
Thanks for you help!