Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
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!

1 Solution

Accepted Solutions
swuehl
MVP
MVP

And could you elaborate on 'does not work', please. Expression returns zero? Wrong value <> zero?

If you need to find the max year in your data ignoring selections:

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

View solution in original post

15 Replies
sunny_talwar

Your year field includes Text? May be this:

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

swuehl
MVP
MVP

How do these year values look like? more than 1 value per year, with different chars at the end?

Maybe like

Sum({<Year = {"$(=Maxstring(Year))"}>} Sales)

Anonymous
Not applicable
Author

This didn't work sunny;

Any other thoughts?

Anonymous
Not applicable
Author

MaxString didn't work

I have appended text OL to the year 2016, so the year looks like 2016 OL

please let me know if you can think of something else

sunny_talwar

Try Stefan solution and see if that works, if not please consider sharing a sample

swuehl
MVP
MVP

If you use


Sum({<Year = {"$(=Maxstring(Year))"}>} Sales)

as expression in your straight table and leave the expression label empty, then hover with the mouse over the column header, what do you see?

swuehl
MVP
MVP

And could you elaborate on 'does not work', please. Expression returns zero? Wrong value <> zero?

If you need to find the max year in your data ignoring selections:

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

sunny_talwar

When you put =MaxString(Year) -> What do you see in a text box object? Do you see 2016 OL?

Not applicable
Author

Hi Stefan,

Just out of curiosity, would the two formulas produce the same result?

Sum({<Year = {"$(=Maxstring(Year))"}>} Sales)


and


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