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

Announcements
April 13–15 - Dare to Unleash a New Professional You at Qlik Connect 2026: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
markjay27
Contributor II
Contributor II

Date Filter Buttons

In every app I create, I typically need to have date filters in the form of buttons, 30/60/90 Days buttons. I get the scripts from ask sage or claude, and I've tried everything floor function, date, datestamp, etc in the scripting, but these buttons never work and I'm not sure why. The action is set to select in a field and the field is set to the field that holds the date to be filtered. Any expert help would be greatly appreciated.

Labels (3)
4 Replies
rubenmarin

Hi, you can create the field values in script, like:

If(Today()-DateField<=30, 30
  ,If(Today()-DateField<=60, 60
    ,If(Today()-DateField<=90, 90
      ,'Over90'))) as DayRange

And then set the buttons to select on this 'DayRange' field

markjay27
Contributor II
Contributor II
Author

this would be placed in fx, values, or both?

marcus_sommer

The suggested DayRange could be applied as set analysis condition, like:

sum({< DayRange = {30}>} MyValue)

as well as a chart-dimension and/or as a selection.

Using buttons to transfer an user-interaction as selection/condition is in each case a detour ...

rubenmarin

Hi, as you posted "I get the scripts from ask sage or claude, and I've tried everything floor function, date, datestamp, etc in the scripting", that was an example on how to create the buckets on the script.

I think you first need to check if it's created as expectd, just add a simple table with the date field and the DayRange field to check each date is assigned to the expected value. If not maybe it's because the Date field is not really a date, just a text formatted as date,in that case you can replace "DateField" with Date#(DateField, 'DD/MM/YYYY') being 'DD/MM/YYYY' the format of the date.

This date format issue is just a guess, many things might be adjusted, you'll need to provide us more info of what are you trying, like some part of the script used, what you are getting right now and what you expect. And if you can upload a sample demonstrating the issue you can get a solution faster.