Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Bar chart color doesnt work

Hello everyone,


I have a calculated dimension in a bar chart and an expression where I have set a condition in the background tab in order to get the bars in different colors. However, it doesn't work, it only works if I go to another sheet and make a selection there which includes some values of my dimension and then go back to the chart. Does someone know the problem?

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

The first expression will not work since you don't have any field references in it.

The second could work - if you have "account" as dimension, but I assume that you don't. If you don't, "account" will evaluate to NULL - since there are several possible accounts. It could even be that you have school accounts and office accounts on the same line. Hence, you need to add an aggregation function.

Read more here: Use Aggregation Functions!

HIC

View solution in original post

4 Replies
hic
Former Employee
Former Employee

What does your color expression look like?

HCI

Not applicable
Author

The calculated dimension is if(account=42 or if(account=44, 'School', if(account=43 or if(account=45, 'Office'))))

And then I have an expression like Sum(Costs) and the color expression I tried both:
=If('School', Red(), if('Office', Green())) and also tried

=if(account=42 or if(account=44, 'Red(), if(account=43 or if(account=45, Blue()))))

hic
Former Employee
Former Employee

The first expression will not work since you don't have any field references in it.

The second could work - if you have "account" as dimension, but I assume that you don't. If you don't, "account" will evaluate to NULL - since there are several possible accounts. It could even be that you have school accounts and office accounts on the same line. Hence, you need to add an aggregation function.

Read more here: Use Aggregation Functions!

HIC

Not applicable
Author

Thank you Henric, I included the only function and it works!