Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

From Date & To Date individual date selection script approach

cancel
Showing results for 
Search instead for 
Did you mean: 
Kushal_Chawda

From Date & To Date individual date selection script approach

Last Update:

Sep 21, 2022 1:07:35 PM

Updated By:

Sue_Macaluso

Created date:

Feb 19, 2017 6:28:07 AM

Attachments

Hi Qlikers,

I am writing this blog to demonstrate how we can build date range selections via script solutions.

Date range selections are quite common in any BI dashboard. There are many approaches using which we can build this solution in dashboard. Below are few of the approaches. 

Option 1 - Create two data Island table (From Date & To Date). Select From date & To Date from data Island table and store the values in respective variables (vFromDate, vToDate). These variables now can be used in set analysis to get desire output.

Option 2 - Create From Date & To Date table in data model which is associated with Fact table.

There could be other ways also to achieve the above scenario.

Though option 1 is easy to implement, on large data set it could cause performance issue as we are using data Island tables.

I am going to share the Option 2.  This option makes use of associative model using script solution.  Basically date range selections populates all the dates within that range and associates it with source/fact table. Advantage of using this approach is we can make use of Qlik's associative model so that creating complex expressions are not required.

Below is the screenshot of model

Screenshot 2020-09-23 124625.png

 

Screenshot 2020-09-23 125000.png

 

Update:

Added FromWeek-ToWeek and FromMonth-ToMonth functionality

Added qvf file

Feel free to provide any suggestions.

 

Regards,

Kushal Chawda

Tags (1)
Comments
b_garside
Partner - Specialist
Partner - Specialist

Simple and Elegant solution vs Going with Option 1.

passionate
Specialist
Specialist

Hi Kushal,

Good and informative blog.

- If you can add some technique so that Start date must not be more than End date and vise versa.

This can be achieved through field trigger but, is there any better approach.

Thanks for Sharing,

Cheers,

Pankaj

Contributors
Version history
Last update:
‎2022-09-21 01:07 PM
Updated by: