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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Stars
Creator
Creator

How do I lock data on a trend chart?

I've built all kinds of charts using the suggestions you all have given me and everything works great - except trends.  I want to have a trend chart with five lines: fractile (25), fractile (50), fractile (75), average, and company.  The fractiles and average are calculated with equations, they're not pre-calculated data.  I want to be able to see these lines on the trend and then, when I select a company, I want the company data to show up on the trend chart, but the means and quartiles to remain unchanged.  When I build a distribution plot or gauge or bar chart, I can do this.  But I can't do it for trends!

Here's what I'm using for company data:

=(Avg( Aggr((
(Sum({<Question={'Cat1','Cat2','Cat3'}>}Response)))
/(Sum({<Question={'Cat4'}>}Response))
,Company,Year)))

And here's what I'm using for average data:

=(Avg( Aggr((
(Sum({1<Question={'Cat1','Cat2','Cat3'},Company>}Response)))
/(Sum({1<Question={'Cat4'},Company>}Response))
,Company,Year)))

The only difference between these equations and the equations that work correctly in my gauges and distribution plots is that I've deleted the    { 1 < Year = { $ ( = Max ( Year ) ) } > }    piece at the beginning of the equations because I want a trend, not just one year of data.  What am I doing wrong?!  Any suggestions would be great.  I imagine I'm missing a 1 or using the wrong brackets or.... something....

Thank you!

1 Solution

Accepted Solutions
Lisa_P
Employee
Employee

You need to also add the {1} into the avg aggregation to ignore selections there too:

=(Avg ( {1} Aggr((
(Sum({1<Question={'Cat1','Cat2','Cat3'},Company>}Response)))
/(Sum({1<Question={'Cat4'},Company>}Response))
,Company,Year)))

View solution in original post

3 Replies
Lisa_P
Employee
Employee

You need to also add the {1} into the avg aggregation to ignore selections there too:

=(Avg ( {1} Aggr((
(Sum({1<Question={'Cat1','Cat2','Cat3'},Company>}Response)))
/(Sum({1<Question={'Cat4'},Company>}Response))
,Company,Year)))

Stars
Creator
Creator
Author

Perfect, thank you!  Do you know why it doesn't need to be locked on the other graphs?  I don't have the {1} there on reference lines on my bar charts or distribution plots and I don't have it there on my limits for my gauges and they still lock.  But this worked, so thank you!

Lisa_P
Employee
Employee

It's about each level of aggregation ignoring selections.  If you don't do it there, then the average will change based on your selections.