Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
twanqlik
Creator
Creator

Line chart - color based on below/above target

 

I'm trying to create a line chart that is following the colors as how is visualised in the below chart.

- Red when it is below target
- Green when it is above target

Is this possible in Qlik Sense? 

 

Capture.JPG

3 Replies
gavinlaird
Contributor III
Contributor III

If you have the Target expression stored in the first expression, and the the 2020 value stored in the second expression, you can use this for the "Background Color" of the 2020 expression:

=if(NOT len(column(1))>0,DarkGray(),
	if(column(2)>=column(1),Green(),Red()))

 

This will produce this chart:

 pic1.png

 

sample qvw is attached.

Kushal_Chawda

Put below expression as shown in image

=if(YourExpression>TargetEpression, Green(),lightred())

Capture.JPG

rnorris
Partner - Contributor III
Partner - Contributor III

Is it possible to do this in Qlik Sense yet? 

Kushal's answer is basically the only answer I can find, but for no obvious reason it sets the colour of both measures, which looks terrible.

Creating a master measure for the line expression and creating a master measure for the bar expression, and then setting the colour for both of them, is both annoyingly fiddly, adding countless extra steps to what should be a simple process, and also, doesn't work.

Because you can't set an expression for the colour in the master measure, and the expression in the chart settings just overrides whatever you've set in the master measure.

I feel like having some kind of threshold line on a bar chart with conditional colour for the bars based on whether they are above or below the line is pretty noddy stuff. I KEEP running into hurdles like this with Sense, and it's honestly doing my nut.