# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Valued Contributor

## Change bar chart color if value is above average.

Hello Folks,

I've got a simple bar chart, with an Average calculation reference line.  Thus far, it looks like this.

What I would like is that when the Bar is above the reference line, it's Blue and when it's below the reference line it's Green

My expression looks like so:

If( Count(Order) > Avg(Aggr(Count(Order),[Scheduled Week])), Blue(), Green())

But not matter what, the bar is ALWAYS green.  What should I be using to get this to work?  For instance, the value 226 should be Blue as it is above the average and the value of 184 is below the average.

Any help is greatly appreciated.

1 Solution

Accepted Solutions
MVP

## Re: Change bar chart color if value is above average.

Your bar chart seems to be suffering from an inverse "Lake Wobegon effect" (Lake Wobegon - Wikipedia).

If( Count(Order) > Avg(TOTAL Aggr(Count(Order),[Scheduled Week])), Blue(), Green())

-Rob

http://qlikviewcookbook.com

2 Replies
MVP

## Re: Change bar chart color if value is above average.

Your bar chart seems to be suffering from an inverse "Lake Wobegon effect" (Lake Wobegon - Wikipedia).

If( Count(Order) > Avg(TOTAL Aggr(Count(Order),[Scheduled Week])), Blue(), Green())

-Rob

http://qlikviewcookbook.com

New Contributor III

## Re: Change bar chart color if value is above average.

Hi Justin,

Try Putting your expression in a variable and then try.

Something like this

if( Sum(Sales)  >

\$(vAvg),Blue( ),Green( ) )

Regards,

Rajan