Link to home
Start Free TrialLog in
Avatar of Janice Smith
Janice SmithFlag for United States of America

asked on

Date formula that goes back 5 years

Hello Experts,
Is there a way to create a date formula that will pull records from the current date back 5 years?  The formula should look at a date time field on the report and retrieve records that go back 5 years from the current date. The report is querying an Oracle database. Any suggestions?  Thanks.
Avatar of Mike McCracken
Mike McCracken

Use the SELECT EXPERT

{DateField} >= DateAdd('yyyy'-5,CurrentDate)

mlmcc
Avatar of Janice Smith

ASKER

Thanks...
I used the following formula:
{CASE.FILE_DT} >= DateAdd('2010'-5,CurrentDate)
and I get the error message that "A number, currency amount, date, time, or date-time is required here."
Where do you get that?

You have to add that to the selection filter
REPORT --> SELECT EXPERT

mlmcc
Yes, I did add it to the select expert and that's the error that comes up
i see the issue.

Don't use 2010 use yyyy
You are telling dateadd to add years

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you. This works perfectly.