Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Custom AVG Trend Line

Does anybody know whick is the expression to make an custom AVG Trend Line in a graphic for example of the value Sum(Sales) and dimension CalendarMonthAndYear?

Thanks and happy weekend.

1 Solution

Accepted Solutions
whiteline
Master II
Master II

Hi.

You could use total statement to calculate average value:

=Avg(total NEWVALUE)

Or a bit more complex if you have more than one value for each YEARMONTH:

=Avg(total aggr(Sum(NEWVALUE), YEARMONTH))

View solution in original post

9 Replies
Not applicable
Author

Hi,

Please find the attached doc.

Hope it helps you.

Regards,

yaseen

Not applicable
Author

Sorry but I don't get it. The AVG line is in the bottom of the graphic and all of the bars are equal.

Did I miss anything?

Regards

Not applicable
Author

Hi,

My dats is having same values so the line is at the bottomn.

Please chk the doc now.

Regards,

Yaseen

Not applicable
Author

I still don't get it. Why do you use the percentage for the AVG? According to the data you use, the AVG line should be in the 110 value and parallel to the X axis. Do you agree?

Captura.JPG

jagannalla
Partner - Specialist III
Partner - Specialist III

Hello,

Add your dimension as YearMonth & expression as =Sum(Val). Now at left button of expression tab, just check Average in TrendLInes.


Hope it helps you

Cheers!!

Jagan

Not applicable
Author

Thanks Jagan, I already knew that, the problem is that you can't format the prese trend lines. For example a dash line. That's why I want to make a new one by myself.

Thanks anyway

jagannalla
Partner - Specialist III
Partner - Specialist III

I think you can go to presentation tab of chart -> Reference Lines -> Add -> in expression tab, =Avg(val)

whiteline
Master II
Master II

Hi.

You could use total statement to calculate average value:

=Avg(total NEWVALUE)

Or a bit more complex if you have more than one value for each YEARMONTH:

=Avg(total aggr(Sum(NEWVALUE), YEARMONTH))

Not applicable
Author

The 2nd one works for me!! Thanks. The expression finally is:

Avg(total aggr(((SUM( {<Supplier={'PNA010031'}>} Purchase.Amount)*-1)/SUM(  {<Customer={'CNA008007','CNA008008'}>}Sales.Qty)), CalendarMonthAndYear))

Thanks a lot you all for your time