Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

Date filter in Load script

Hi,

I am very new to QV and am trying to create a report in QV that I will be running every quarterly. I am trying to filter the date field in my SQL select statement in the load script so to load the dashboard with the last quarter data each time. However, I am having no luck. the script is:

OLEDB CONNECT TO XXXXXXXXX

[Table_Name]:

SQL Select ......,

                   "ETL_DATE",

                    .........

From "XXXXXX";

The reason for this filter is so that I do not have to load over a million records each time I select "RELOAD" and my QV dashboard does not crash or take many hours when it comes to refreshing the data and can load only the selected dates.

Please can some one help me with this?

3 Replies
Highlighted
Specialist
Specialist

SELECT DATEADD(dd, -1, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()), 0)) as LastDayOfPreviousQuarter

SELECT DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) - 1, 0) as FirstDayOfPreviousQuarter

SELECT DATEADD(qq, DATEDIFF(qq, 0, GETDATE()), 0) FirstDayCurrentQuarter

SELECT DATEADD (dd, -1, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) +1, 0)) LastDayCurrentQuarterquarterExample.PNG

Highlighted
Specialist
Specialist

Select *

FROM SomeTable

WHERE SomeDateColumn BETWEEN DATEADD(qq, DATEDIFF(qq, 0, GETDATE()), 0) AND DATEADD(dd, -1, DATEADD(qq, DATEDIFF(qq, 0, GETDATE()) +1, 0));

Highlighted
Contributor
Contributor

Thank you so much William