Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
wdchristensen
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

wdchristensen
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));

Anonymous
Not applicable
Author

Thank you so much William