Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Magogar
Contributor III
Contributor III

Make a button to select the date range of the previous year

Hello.

How can I make a button to select the date range of the previous year. Everything I've tried so far fails.

Magogar_0-1706874611142.png

Magogar_1-1706874924367.png

 

=Year(max([fecha]))-1

=(max({<[fecha.autoCalendar.Year]={"$(=Year(max([fecha])))"}>}[fecha]))-1

 

Thank you!

Labels (1)
1 Solution

Accepted Solutions
MatheusC
Specialist
Specialist

see with the following expression, put your date field

Concat({<[fecha]= {">=$(=Date(YearStart(max([fecha]),-1),'DD/MM/YYYY'))<=$(=Date(Yearend(max([fecha]),- 1),'DD/MM/YYYY'))"}>} DISTINCT date([fecha]), ';' )

Regarts,
Matheus 

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!

View solution in original post

4 Replies
MatheusC
Specialist
Specialist

Hi, @Magogar 

try to adjust like:

max([fecha])-1

or

year(today())-1

Regarts,
Matheus

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Magogar
Contributor III
Contributor III
Author

Thanks, but it doesn't work. The dates are in DD/MM/YYYY format, and I want to get the date range of the previous entire year. For the buttons I don't know how to write it.

=Year(max([fecha]))-1

=max(year([fecha.autoCalendar.Year]))-1

=max(year([fecha.autoCalendar.Year])-1)

=max([fecha.autoCalendar.Year])-1

 

MatheusC
Specialist
Specialist

see with the following expression, put your date field

Concat({<[fecha]= {">=$(=Date(YearStart(max([fecha]),-1),'DD/MM/YYYY'))<=$(=Date(Yearend(max([fecha]),- 1),'DD/MM/YYYY'))"}>} DISTINCT date([fecha]), ';' )

Regarts,
Matheus 

Did you find a solution to your question? Mark the solution as accepted and if you found it useful, press the like button!
Magogar
Contributor III
Contributor III
Author

Awesome! it works perfectly. Thanks a lot.