Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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))
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))
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')