Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW

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 25, 2024 2:08:28 PM

Updated By:

Kushal_Chawda

Created date:

Feb 19, 2017 6:28:07 AM

Attachments

Date range selections are a common feature in any BI dashboard, and there are several ways to implement this functionality. Below are a few options:

Option 1: Create two data island tables (From Date & To Date). Users can select the From and To dates from these tables, and the selected values can be stored in variables (vFromDate, vToDate). These variables can then be used in set analysis to produce the desired output.

Option 2: Create From Date and To Date tables within the data model, associating them with the Fact table.

There are other approaches to achieve this scenario as well.

While Option 1 is easy to implement, it may lead to performance issues with large datasets due to the use of data island tables.

I will demonstrate Option 2, which utilizes an associative model through a script-based solution. In this approach, date range selections populate all the dates within the selected range and associate them with the source/fact table. The advantage of this method is that it leverages Qlik’s associative model, eliminating the need for complex expressions.

Below is a screenshot of the 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

Version history
Last update:
3 weeks ago
Updated by: