Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
terezagr
Partner - Creator III
Partner - Creator III

Select Max Year where Year format is yyyy/y

Hi all,

I have a list of years where the format is like YYYY/Y

so eg.

2013/4

2014/5

2015/6

I am trying to set a trigger so when user open the sheet in QlikView the latest year will be preselected and the last year too.

I have tried

Select in field-> YEAR

Search string-> =max(YEAR)

No luck…any suggestions?

Thanks T.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

May be like attached sample. Note, the YYYY/Y format's /Y is actually redundant and since single Y doesn't qualify a proper date format, it can be formatted with any meaning single character format like I did using YYYY/D. Ultimately, we are bothered about year.

Search string for second max year =Max(Year(Date#(Year,'YYYY/M')),2)&'/'&Right(Max(Year(Date#(Year,'YYYY/M')),2),1)

View solution in original post

11 Replies
alexandros17
Partner - Champion III
Partner - Champion III

max(Left(YEAR,4))

nagaiank
Specialist III
Specialist III

Use the search string '=MaxString(Year)'

terezagr
Partner - Creator III
Partner - Creator III
Author

When testing in text box, I get only 2015…but I need the 2015/6 to be selected in the list….

alexandros17
Partner - Champion III
Partner - Champion III

The best thing is to compute year as YYYY and month as MM

to achieve this:

load:

...

myYear * 100 + myMonth as Yearmonth,

...

In this way you have only to write max(Yearmonth)

terezagr
Partner - Creator III
Partner - Creator III
Author

Thanks, this works for the latest year…but what about the last year? MaxString(Year)-1 does not seem to work...

MK_QSL
MVP
MVP

=FirstSortedValue(Year,-Right(Year,1))

Clever_Anjos
Employee
Employee

=max({1}YEAR) as expression

Clever_Anjos
Employee
Employee

"latest year will be preselected and the last year too." do you have two fields?

terezagr
Partner - Creator III
Partner - Creator III
Author

yes I do and I apply different states on those too….so the latest one will have State 1, the last year one then State 2