Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Umeiko
Partner - Contributor II
Partner - Contributor II

Average trend line calculation

trendline.png

I wondered if it is possible to change bar-color "above average trend line",  like the picture I posted above?

I tried to write an expression to calculate the RGB color but  it doesn't work.

It might be because that I don't know what the average trend line formula is.

The expression shows correct but doesn't work.

How can I solve the problem? 

I Mei, Huang
Labels (1)
3 Replies
Chanty4u
MVP
MVP

Use this measure

Above(Sum(Sales), Avg(TOTAL Sum(Sales)))

 

In colours tab colours by expression 

Kushal_Chawda
MVP
MVP

@Umeiko  what is your bar chart expression?

Umeiko
Partner - Contributor II
Partner - Contributor II
Author

@Kushal_Chawda @Chanty4u 

My bar chart expression is "budget achievement rate" like below:

= 1+(Sum({$<[Profit_item]={'Booking'}> } [Curmo_billing]) -Sum({$<[Profit_item]={'Booking'}> } [curmo_budget]))
/ fAbs(Sum({$<[Profit_item]={'Booking'}> } [curmo_budget]))

That's why I don't know how to get the average trend line.

I tried expression below in color tab, qlik window shows "correct" but it doesn't work

=if( 1+(Sum({$<[Profit_item]={'Booking'}> } [Curmo_billing]) -Sum({$<[Profit_item]={'Booking'}> } [curmo_budget]))
/ fAbs(Sum({$<[Profit_item]={'Booking'}> } [curmo_budget]))> avg(Total aggr(avg(1+(Sum({$<[Profit_item]={'Booking'}> } [Curmo_billing]) -Sum({$<[Profit_item]={'Booking'}> } [curmo_budget]))
/ fAbs(Sum({$<[Profit_item]={'Booking'}> } [curmo_budget]))))), RGB(0,200,0), RGB(220,100,50))

I Mei, Huang