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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
JuDu1905
Contributor II
Contributor II

Bar chart colour by key figure

In this bar chart I would like to set the colours so that as soon as a key figure is above 0 it appears green, as soon as it is below 0 it should be red. This classification should apply to every key figure.

What setting can be used to do this? A general limit cannot be set for this type.

JuDu1905_0-1623054466491.png

 

5 Replies
chrismarlow
Specialist II
Specialist II

Hi,

If by key figure you mean the your measure (looks like a sum), I think then under Appearance you would set colors off Auto to Custom & then set By Expression, similar to below;

20210607_3.png

Cheers,

Chris.

JuDu1905
Contributor II
Contributor II
Author

Exactly, I understand everything with an if-formula, only the input "mea" is inconclusive with me. There are different measures, for me they don't always colour after the first key measure, that shouldn't be the case.

chrismarlow
Specialist II
Specialist II

Hi,

I am not sure I follow. Do you mean your bars have different formulae? Can you share the dimensions and expressions for your chart and some dummy sample data?

Cheers,

Chris.

JuDu1905
Contributor II
Contributor II
Author

Exactly, it is other formulas that are shown in the diagram.

The total deviation is + 33.541, so this should be shown in red.
The result that follows is approx. -17,000 and is called the prod deviation. Since this is negative, it should be shown in green.
The third measure is the backlog deviation and is +301.58. It should therefore be shown in red again.

I would like to mark different measures in red or green, based on the limit 0.

Thanks!

chrismarlow
Specialist II
Specialist II

Hi,

Apologies been busy but just spotted your reply to this.

Could you try using ValueList to fool this into thinking you only have 1 measure, so dimension something like;

ValueList('1','2')

And single measure;

pick(match(ValueList('1','2'),'1','2'),sum(mea1),sum(mea2))

Then color;

if(pick(match(ValueList('1','2'),'1','2'),sum(mea1),sum(mea2))<0,Red(),Green())

I've attached an app showing the above.

Cheers,

Chris.