Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
avinashkk696
Contributor III
Contributor III

Bar Chart Color issue

Hi Guys,

 

I have a issue with the bar chart where I want to customize the bar colors. Below is how my data looks like.

image.png

In the above chart I want to display the bars in red color if the ColB=User1. Expression I have used in colors is if(ColB='User1,Red(),green()'). But Its not working.

Thanks.

Labels (3)
1 Solution

Accepted Solutions
miguelbraga
Partner - Specialist III
Partner - Specialist III

Hi there,

 

Try this coloring:

=if(Wildmatch(Concat(ColA & ColB, ','), '*User1*'),red(),green())

 

Screenshot_1.png

 

Best regards,

MB

View solution in original post

7 Replies
miguelbraga
Partner - Specialist III
Partner - Specialist III

Hi there,

 

I think you have a problem in the quotes of the expression. Please change to this one:

=if(ColB='User1',red(),green())

 

Hope this solves your problem. Keep it in mind the right quotation when writing your code.

 

Best regards,

MB

agni_gold
Specialist III
Specialist III

You have placed your color logic in wrong place , please check attached file , here i have placed color logic in expression tab.

avinashkk696
Contributor III
Contributor III
Author

Thanks for your reply.

According to the data, 'B' and 'J' should also be in red color. Your solution works fine when the ColB value is unique for the ColA value. As 'B' has multiple ColB values associated to that, we are having this issue.  That is exactly my problem.

miguelbraga
Partner - Specialist III
Partner - Specialist III

Hi there,

 

Tell me what you want. Do you want a chart with multiple color where it marks the revenue that are in User1 or do you want to fill the color to red if there is revenue with User1?

 

Best regards,

MB

miguelbraga
Partner - Specialist III
Partner - Specialist III

Hi there,

 

Try this coloring:

=if(Wildmatch(Concat(ColA & ColB, ','), '*User1*'),red(),green())

 

Screenshot_1.png

 

Best regards,

MB

sunny_talwar

Another option is to use this as your background color expression

=If(Count({<ColB = {'User1'}>} ColB) > 0, Red(), Green())

image.png

avinashkk696
Contributor III
Contributor III
Author

Thanks Braga  and Sunny for your response... 

You guys just made my day... So thanks for Braga.. Your solution worked perfectly fine.. 

Sunny - Your solution worked fine in the sample app but have a problem with my original data. Though, it was a great help in solving the issue. Thank you..