Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
QS_
Contributor III
Contributor III

Load Data for previous month only from the data warehouse

I'm trying to load only the previous month's data from the data arehouse.

I'm trying to use the following condition

WHERE MonthStart(flt_date)=MonthStart(Date(Today())-1)

But there seems to be an error which prevents the loading of the data. 

Previously, I have been using the following WHERE statement and it was working without any problems. 

WHERE flt_date>'2023-06-30' 

However, I wanted to limit the data loading a bit more dynamically than changing the dates each month.

Labels (4)
1 Solution

Accepted Solutions
Cascader
Creator
Creator

 

try: 

this will give last day in pervious month

MonthEnd(AddMonths(Today(), -1))

 

this will give you first day of pervious month 

MonthStart(AddMonths(Today(), -1))

View solution in original post

2 Replies
Cascader
Creator
Creator

 

try: 

this will give last day in pervious month

MonthEnd(AddMonths(Today(), -1))

 

this will give you first day of pervious month 

MonthStart(AddMonths(Today(), -1))

QS_
Contributor III
Contributor III
Author

Thank you! Your solution was what worked.

First I created the variable with the formula in your answer for the beginning of the month.

LET vStartDate=date(MonthStart(today(),-1),'DD/MM/YYYY')

Then I updated my WHERE clause like so:

WHERE flt_date>=to_date('$(vStartDate)','DD/MM/YYYY')