Qlik Community

QlikView Documents

Documents for QlikView related information.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.

From Date & To Date Selection Script Solution

From Date & To Date Selection Script Solution

Hi Qlikers,

I have written this blog to showcase how from date & to date can be used to select the date ranges in QlikView associative model.

Scenario:

Let's say I want to calculate count of employees joined in organization between 1/1/2017 to 15/1/2017. So here reference date would be Date of joining.

There are many ways to achieve above scenario.

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.

Below is the screenshot of data model created with Option 2.

Advantage of using this approach is, calculation will be performed on associated data which can give faster results as compared to option 1 approach.

I have attached qvw file.

Feel free to provide any suggestions.

Regards,

Kushal Chawda

Attachments
Comments
b_garside
Valued Contributor

Simple and Elegant solution vs Going with Option 1.

passionate
Valued Contributor

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
Revision #:
1 of 1
Last update:
‎02-19-2017 06:28 AM
Updated by: