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: 
mjk23400
Contributor
Contributor

Show most recent year value based off filter pane selection

Hello,

I am a newer user and have done some searching around the forum but couldnt find a solution for my exact issue.  I have a data set with 20 years of data for 15 plus companies and on my analysis page I have a filter pane to select which years' data to show depending upon what analysis needs to be done.  I have a scatter plot with 3 measures chosen (std dev, % return and annual sales).  I am looking for a way to only display the most recent years' sales data whenever a different subset of years is chosen from the filter pane (while keeping the std dev and % return as the avg of the years chosen).  For example, if data from 2015-2019 is chosen I just want 2019's annual sales shown , while providing the averages of the dev and return % (which was easier to complete that part).

what i have below doesnt work properly but I was hoping i am on the right path. any help is appreciated! 

Max({<Period={GetFieldSelections()}>} [YE Sales(Actual)])

Labels (2)
3 Replies
Or
MVP
MVP

Perhaps Sum({<Year={"=$(=max(Year))"}>} [YE Sales(Actual)])?

Searching for qlik sum for max period should return any number of hits for what appears to be the same question, at least to me. If this isn't what you were after, perhaps one of those threads will help.

mjk23400
Contributor
Contributor
Author

thank you for the response.  I tried your suggestion but unfortunately it doesnt appear to be working as I am intending.  As I test it and select various years from the filter pane, it doesnt properly update to show the most recent years' data from the selection.  

Max({<Period={'2017','2018','2019'}>} [YE Surplus (Actual)]) 

something like this works to an extent, however the issue im having is incorporating into the expression the ability to update based on the years that are selected from the filter pane.  thats why i was thinking the getfieldselection may help because it would be reflective of the periods selected from the filter pane and then based off whats selected, provide the most recent years data 

Or
MVP
MVP

If you aren't getting the expected result, check that the inner formula for the set analysis is getting the expected year. You may have to tweak the syntax somewhat, add a max(total Year) qualifier, etc, but generally speaking, it should work.