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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Stars
Creator
Creator

Displaying Mean by Year for Trend Chart

I'm trying to understand reference lines.  I would like to add the mean to my trend chart, which shows margin over time for three companies.  When I try to ass the mean, I get the combined mean for all years (see image).  Is there a way to have it calculate the mean for each year instead, so the mean shows a trend, instead of a flat line?

My expression for my measure is:

Min({$<Cost={"Metric1"}>}Value)/Min({$<Cost={"Metric2"}>}Value)

 

My expression for my reference line is:

=Avg(TOTAL Aggr(Min({$<Cost={"Metric1"}>}Value)/Min({$<Cost={"Metric2"}>}Value), Year))

1 Solution

Accepted Solutions
treysmithdev
Partner Ambassador
Partner Ambassador

Sorry, I didn't realize this was for the reference line. Unfortunately, the short answer is no. Reference lines do not have any dimensionality. It will evaluate to 1 number, and that value is used for the line. Don't think of it as another measure in your chart, it's merely a threshold/identifier.

Blog: WhereClause   Twitter: @treysmithdev

View solution in original post

4 Replies
treysmithdev
Partner Ambassador
Partner Ambassador

Try this:

=Avg(TOTAL <Year> Aggr(Min({$<Cost={"Metric1"}>}Value)/Min({$<Cost={"Metric2"}>}Value), Year))
Blog: WhereClause   Twitter: @treysmithdev
Stars
Creator
Creator
Author

Thanks!  I tried it, but nothing changed....  The expression LOOKS better, but didn't seem to make any difference.

treysmithdev
Partner Ambassador
Partner Ambassador

Sorry, I didn't realize this was for the reference line. Unfortunately, the short answer is no. Reference lines do not have any dimensionality. It will evaluate to 1 number, and that value is used for the line. Don't think of it as another measure in your chart, it's merely a threshold/identifier.

Blog: WhereClause   Twitter: @treysmithdev
Stars
Creator
Creator
Author

Thank you!  That helps.  I'll keep trying to add the mean to my trend chart, but not via a reference line.