Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
dmitroika
Contributor
Contributor

Color expression for different measures in bar chart

Hi guys,

I have a bar chart with 2 different measures. I would like measure1 to stay as a single color, while the measure2 should change color based on 3 set of values. 

I created master items for measures 1 & 2 and set color segment for measure2.

However, it doesn't work.

Here are the conditions that i need for measure2:

if measure2 < 0, red, if measure2 >0 and <=4, blue, if measure2 >4, green.

However, Measure1  must be yellow for all values

Thanks for your anticipated assistance.

Note: in the attachment file, measure1 is in yellow (correct) but measure2 is in red(wrong)

1 Reply
lfetensini
Partner - Creator II
Partner - Creator II

Use ValueList() ghost dimension trick.


[DIMENSIONS]:

1 Dimension: Your Dimension

2 Dimension:
= ValueList('measure1','measure2')
Label: Rename with your label


[MEASURES]:


Pick(Match(ValueList('measure1','measure2')),
'measure1',
'measure2'),
Sum(field), // Formula for Measure 1
Sum(field)) // Formula for Measure 2

[APPEARANCE COLORS]:

Check box: "The expression is a color code".


Pick(Match(ValueList('measure1','measure2')),
'measure1',
'measure2'),
Blue(),
Pick(Match(-1,
FORMULAMEASURE2 < 0,
FORMULAMEASURE2 > 0 and FORMULAMEASURE2 <=4,
FORMULAMEASURE2 > 4),
Red(),
Blue(),
Green())

Support your colleagues. Remember to "like" the answers that are helpful to you and flag as "solved" the one that helped you solve. Cheers.