Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted
Not applicable

Calculated color of bars in chart using expression background color and Avg function

Commonly asked question but the answers to this usually use a specific value, not an avg or other funtion...

I have a simple bar chart and I'd like to color some bars a different color, based on some expression in the background color area in the Expression.

I have a bar chart, Services is the dimension and Cases is the expression. In the expression (background color), I use this calculated color, and it works:

=If (Cases > 597, Color (1), Color(2)

But when I try the following, using Avg, it does not work.

=If (Cases>avg(Cases), Color(1), Color(2))

Seems so simple... any ideas are much appreciated. Thank you -

(note that the red reference line is also set to Avg(Cases)

WT

1 Solution

Accepted Solutions
Not applicable

Re: Calculated color of bars in chart using expression background color and Avg function

I found the solution:

=If (sum(Cases)>=avg(total(Cases)), Color(1), Color(2))

This produced the desired effect, as if hard coding the value.

2 Replies
Not applicable

Re: Calculated color of bars in chart using expression background color and Avg function

I found the solution:

=If (sum(Cases)>=avg(total(Cases)), Color(1), Color(2))

This produced the desired effect, as if hard coding the value.

Not applicable

Re: Calculated color of bars in chart using expression background color and Avg function

Yes because i think to compare it reqiures the aggreagate function

Community Browser