Dynamic Date Range, always pull data from previous End of Month

Database
Enthusiast

Dynamic Date Range, always pull data from previous End of Month

I have a query that has a hard date input which pulls data base on EOM date entered when the query is edited

ie: Where A.AS_OF_DT = '2017-04-30'

 

How do I write this so that it is dynamic and the user who runs this query does not need to enter a date. The system will automatically grab the the EOM date from 1 month prior each time its ran?

 

Would love some help!

Thanks!

3 REPLIES
Enthusiast

Re: Dynamic Date Range, always pull data from previous End of Month

Figured it out. Thanks!

Junior Contributor

Re: Dynamic Date Range, always pull data from previous End of Month

Well, when you figured it out it would be nice to show what you did.

Enthusiast

Re: Dynamic Date Range, always pull data from previous End of Month

LAST_DAY(ADD_MONTHS(DATE,-1)) That is literally it.