Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Qlik Connect 2025! Where innovative solutions turn your data visions into reality: REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

2 conditions color for bar graph (positive/negative AND total bar)

Hi,


In a bar graph, how can I have different colors for positive and negative values AND at the same time have a different color for the Total bar?


Thanks.

14 Replies
sushil353
Master II
Master II

Hi,

In the expression tab: expand + sign of expression and define the desired color in background of expression.

you can use RGB() for specific color.

HTH

Sushil

Not applicable
Author

I'm in the tab (for Background color) using IF conditions and RGB function but don't manage to obtain the right result... I don't use If condition correctly I think...

= if(Dimensionality()=0,RGB(27,125,156),

if([Dim]>=0,RGB(255,0,0),RGB(0,185,0))

sushil353
Master II
Master II

Try to use expression in your if condition ..

say your expression is sum(values) then

=if(sum(Values)>=0,RGB(255,0,0),RGB(0,185,0))

PrashantSangle


Hi,

Dont use Dimensionality() it servers for different prupose.

Write your expresssion which calculating +,- value in if clause

Like this

IF(Your expression>0,RGB(27,125,156),RGB(255,0,0))

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

That works well to have different color for positive and negative values. But I don't manage to change (on top of that) the color of my total bar... (I manage to do one or the other but not both at the same time...)

Not applicable
Author

I'd like to have green for positive Value, Red for negative value and Blue for the total bar on the right....

Graph.jpg

Thanks again for your support...

PrashantSangle

Hi,

what is your expression?

can you share sample file?

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

Dim.jpg

PrashantSangle

Hi,

can you tell us what is your expression which gives your +,- Values

Not your Background expression.

Also check in Help menu.what is use of Dimensionality()

It returns

number of dimension columns that have non-aggregation content. i.e. do not

contain partial sums or collapsed aggregates

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂