
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Date Picker- default selected date compare to
Hi,
I'm using the Date Picker object while having two calendars in my script.
1. Calendar - which represent "Current Date"
2. Calendar_2 - which represent "Compare To"
What I want to create is the option that when the user selects the "current date", on default the" compare to" will be on the same days last week.
Is that possible?
Thanks,
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
If my understanding is correct, you would like to select a date range in the first Date picker, such as from "1/24/2021" to "1/31/2021" and you would like to automatically have the second Date picker select the dates from "1/17/2021" to "1/24/2021", where this range has 7 days difference.
To implement this solution, you will have to attach a trigger action when the Date1 is selected, however natively this is not supported in Date picker object. There is an extension "qlik-sense-action-triggers" [1], that might be able to help you achieve your desired outcome. You can read the details and test the sample app, to get familiar with the extension, however since it is not developed by Qlik, if you have any issues with the outcome, or you need additional help, then you will have to reach to the developer of the extension.
Another workaround that can help you achieve a similar outcome is the following:
Note: Please keep in mind that this is just a suggestion and the same use case scenario might be achieved with other options as well. However, this is the one that I have fully tested that is working and it can get you as close as possible to the desired outcome.
1. I have the following dataset:
These are data from 2 different tables.
2. Create 2 variables:
3. Create 2 variable inputs:
I have assigned to the first one the variable varFrom and to the second one the variable varTo
4. Create a button with 2 actions:
Both actions have "Select values matching search criteria" as selected option. However first action has the field Date1 and the second variable has the field Date2.
Action 1:
Expression: ='>=$(varFrom)<=$(varTo)'
This expression will select the values in field Date1 based on the values that the user has selected in the Variable input objects.
Action 2:
Expression: ='>=$(=Date(Date(varFrom)-7))<=$(=Date(Date(varTo)-7))'
This expression will first subtract 7 days from the dates that the user has specified in the Variable input objects and then will make the selection in Date2 filed.
After clicking the button this is what I get:
As you can see the first selection is the values that the user has specified and the second selection is the same values but 7 days prior.
I hope that this information was helpful. In case this has helped you resolve the issue, please mark the answer as solution to provide further visibility for other community members. In case I have misunderstood the use case scenario, please elaborate in detail by providing additional information.
---
[1] https://github.com/mcgovey/qlik-sense-action-triggers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @Andrei_Cusnir for your help 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
If my understanding is correct, you would like to select a date range in the first Date picker, such as from "1/24/2021" to "1/31/2021" and you would like to automatically have the second Date picker select the dates from "1/17/2021" to "1/24/2021", where this range has 7 days difference.
To implement this solution, you will have to attach a trigger action when the Date1 is selected, however natively this is not supported in Date picker object. There is an extension "qlik-sense-action-triggers" [1], that might be able to help you achieve your desired outcome. You can read the details and test the sample app, to get familiar with the extension, however since it is not developed by Qlik, if you have any issues with the outcome, or you need additional help, then you will have to reach to the developer of the extension.
Another workaround that can help you achieve a similar outcome is the following:
Note: Please keep in mind that this is just a suggestion and the same use case scenario might be achieved with other options as well. However, this is the one that I have fully tested that is working and it can get you as close as possible to the desired outcome.
1. I have the following dataset:
These are data from 2 different tables.
2. Create 2 variables:
3. Create 2 variable inputs:
I have assigned to the first one the variable varFrom and to the second one the variable varTo
4. Create a button with 2 actions:
Both actions have "Select values matching search criteria" as selected option. However first action has the field Date1 and the second variable has the field Date2.
Action 1:
Expression: ='>=$(varFrom)<=$(varTo)'
This expression will select the values in field Date1 based on the values that the user has selected in the Variable input objects.
Action 2:
Expression: ='>=$(=Date(Date(varFrom)-7))<=$(=Date(Date(varTo)-7))'
This expression will first subtract 7 days from the dates that the user has specified in the Variable input objects and then will make the selection in Date2 filed.
After clicking the button this is what I get:
As you can see the first selection is the values that the user has specified and the second selection is the same values but 7 days prior.
I hope that this information was helpful. In case this has helped you resolve the issue, please mark the answer as solution to provide further visibility for other community members. In case I have misunderstood the use case scenario, please elaborate in detail by providing additional information.
---
[1] https://github.com/mcgovey/qlik-sense-action-triggers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you @Andrei_Cusnir for your help 🙂
