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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
poklegoguy
Creator
Creator

Set default date for date picker in single date mode

Hi, I am working on Qlik Sense Desktop and I want to set yesterday's date as the default date for the date picker so that the user can see the filtered data upon launching the app. The user can only pick one date so I used the single date mode. Is there a way to set a default date for the date picker upon launching the app? I tried setting the expression 'Date(Num(Today()-1))' to both the start date and end date in the configurations but the date is still blank upon launching the app and the user will have to pick the date themselves. In Qlikview, it is easily achievable while it doesn't seem that way in Qlik Sense, or am I missing something? Appreciate any help!

Labels (1)
4 Replies
marksouzacosta

You can set a Default Bookmark with a Dynamic value to get Today's date - check this video for more details: https://youtu.be/tFyqOigqnUw?si=fqf-T0vjBx6BumDS - or set an Action to your sheet to do the same thing. Be aware that date fields can be trick to set values due the format of the fields. Make sure the expression you are creating have the same format and type of your Date fields.

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

poklegoguy
Creator
Creator
Author

Hi @marksouzacosta, thanks for the suggestion! So, there's no way for the date picker object to pick a date by default upon app launching then? 

TauseefKhan
Creator III
Creator III

Hi @poklegoguy,

You can set the default date for the date picker in single-date mode,
Setting a default date for the date picker in single date mode in Qlik Sense requires a combination of settings and scripting.

To Set Default Date for Date Picker:
 
1- Create a Variable for Yesterday's Date: In your Qlik Sense script editor, set the variable during the data load.
        
Create a variable that calculates yesterday's date:    
 
SET vYesterday = Date(Today() - 1);
 
LET vYesterday = Date(Today() - 1, 'YYYY-MM-DD');
 
2- Create a Variable for Date Picker:   
SET vSelectedDate = '$(vYesterday)';
 
3- Load Data and Create Calendar:
    Ensure your data model has a calendar table loaded with dates to be used for the date picker.
 
    LOAD * INLINE [
    Date
    2024-05-20
    2024-05-21
    2024-05-22
    2024-05-23
    2024-05-24
    ];
 
4- Set the Date Picker Object:
      
        Go to the date picker properties and set the variable control to vSelectedDate.
 
5- Set Default Date to Date Picker with Variable:
        Use a Default Bookmark to set the default value for the date picker.
        Create a bookmark that applies the default date:
        Select yesterday's date in the date picker manually.
        Create a bookmark from the selection and name it appropriately, like 'DefaultDate'.
 
Example Bookmark Creation:
 
    Select Yesterday's Date Manually:
        Open your Qlik Sense app and manually select yesterday's date in the date picker.
 
    Create a Bookmark:
        Click on the bookmark button in the toolbar.
        Save the bookmark with a name, for example, DefaultDate.
 
    Apply the Bookmark on App Start:
        Go to the App options.
        Select 'Apply bookmark on app start' and choose the bookmark you just created (DefaultDate).
 
This setup ensures that the date picker shows yesterday's date as default whenever the user opens the app.

 ** When applicable please mark the correct/appropriate replies as "solution". Please LIKE threads if the provided solution is helpful to. **
poklegoguy
Creator
Creator
Author

Hi @TauseefKhan, thanks for the help! However, I don't see any variable control option in the date picker properties, I am on the latest Qlik Sense version, what am I missing?