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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Default Display on open

Hi

I would like my Year and Month list boxes to auto select current year and month when users access the model. How can I do this?

1 Solution

Accepted Solutions
JonnyPoole
Former Employee
Former Employee

check the 2nd half of my post, you can use the Today() function to grab today's date, and the pull the year and month from that 

Year(Today())

Month(Today())   or if your most recent month is behind today's month,   Max(  {$<Year={$(=Year(Today()))}  Month)

View solution in original post

6 Replies
Not applicable
Author

hi goto document properties> on open sheet> add triger > add action > max(year)&max(month)

JonnyPoole
Former Employee
Former Employee

I think you want it on the 'open document' trigger  and use  two  'select in field' actions with the above expressions for the respective fields .

For max month, grab the max month for the max(year) through SET ANALYSIS because even though you have full years, you may be partially through the year at say November and you want November, not December. Here is a sample expression for select in field on the month field.

Max( {$<Year={$(=Max(Year))}>} Month)

you can also use Year(Today()) and Month(Today()) to get back today's year and month, but your app may not have data for today year and month so max() is usually more safe

Not applicable
Author

Thanks for your suggestion guys!

One thing though, I have years in the future as the field I am using for years has years like 2015,2016,2017.

So Max will default to 2017 and I want it to default to the current year.

JonnyPoole
Former Employee
Former Employee

check the 2nd half of my post, you can use the Today() function to grab today's date, and the pull the year and month from that 

Year(Today())

Month(Today())   or if your most recent month is behind today's month,   Max(  {$<Year={$(=Year(Today()))}  Month)

saurabh5
Creator II
Creator II

this expression is what i was looking for as it would avoid  multiple Triggers for the QV document.

Thanks

Jonathan

JonnyPoole
Former Employee
Former Employee

Good to hear.  Worth marking correct / helpful posts so that others with future dates in their model can find the correct solution.