i have data from jan 2018 in my data base but I wan to load only from may 1st -2018
createdDate = 4/30/2018 7:39:24 PM
how to load only from may? what is the where condition?
This should work by setting the date as a variable CDate formatted as YYYY-MM-DD and using that date in the where clause.
Let CDate = date(monthstart(addmonths(today(), -3)), 'YYYY-MM-DD') ;
where createdDate >= '$(CDate)'
If you want to filter your data in LOAD script then:
If you want to filter your data in the db level add this to the where clause of your SQL query:
it is not dynamic right?
for example I have 2 yrs data I wil get both years data greater than april. but I need data greater than April 2018 only
how to do in Sql server Db
Using this expression in the where clause of the sql part of the QlikView load script, will dynamically load data from the 1st of the month 3 months ago. The date(floor()) function converts the datetime value monthstart() to a date.
where createdDate >= date(floor(monthstart(addmonths(today(), -3))))
So if today is 2018-06-16 Then the load will use where createdDate >= 2018-03-01
if today is 2018-06-17 Then the load will use where createdDate >= 2018-03-01
if today is 2018-07-02 Then the load will use where createdDate >= 2018-04-01
You can change the -3 to whatever value you prefer.