SQL Max Date query to last 30 Days

I have the following statement that currently gets me a specific date, in this case 30 days back. I'm having a brain fart on making the adjustment to pull the combined last 30 days of data, through today, on this one.

Normally this statement excludes the "- 30" and just pulls the data for the current date.

MAX( DT.sql_date )- 30                            as TimeframeStart
                    , CAST( CAST( GETDATE() as DATE ) as DATETIME )- 30 as TimeframeEnd

dateadd(day, -30, max(dt.sql_date))

1 Like

that worked great, thanks!

1 Like