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: 
Anonymous
Not applicable

Need help with dynamic Year calculation in set analysis.

Hi,

I have to make the below expression dynamic in set analysis.

I tried Year = max(Year) & 'OL' which is not right; Then I tried assigning max(Year) & 'OL' to variable and passed it to the Year field in the expression, it says 'Allocated memory exceeded'

=sum({<Year = {'2016 OL'}>}Sales)

NOTE: I am using this in a bar chart and a straight table.

Can someone please help me with this ASAP.

Thanks!

15 Replies
sunny_talwar

Without any selection they will produce the same result. With a selection, they may or may not produce a same result. Essentially, the second expression will always show the same result because it is restricted by using set analysis to now change based on selections ({1})

Anonymous
Not applicable
Author

=MaxString(Year) gives me 2016 OL

ANn Sum({<Year = {"$(=Maxstring({1} Year))"}>} Sales) worked!!

Thanks much you 2!!

Not applicable
Author

Thanks Sunny exactly the answer I was looking for.

sunny_talwar

Awesome, I am glad it did. Please close the thread by marking Stefan's answer as correct (in addition to marking it as helpful) and any other helpful answers

swuehl
MVP
MVP

If max year is always today's year, this should also work

Sum({<Year = {'$(=Year(Today()) & ' OL')'}>} Sales)

sunny_talwar

Thank you

I really appreciate you for taking your time to doing as I asked