Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Functions Not Parameters

Status
Not open for further replies.

pcollins1

Technical User
Jun 19, 2002
72
US
I am writing a report that pulls information for Month to Date, Year to Date, Previous Year Month to Date, and Previous Year Year to Date. I am able to do this using Date Params {?MTD}, {?YTD}, {?PYTD}, etc.. I have it set to run on the Nth day of month in eportfolio. However; I have to reschedule it at the beginning of every month adding the new date params.
Is there a way to use Date Formulas, so I can get rid of the Date Parameters, and it will automatically populate and use the next correct date ranges?

I do have a {Table.DATE) I am selecting against.
 
Sure, if I understand your requirements correctly, it's surprising that people won't post examples, preferring to type out an interpretaion.

Record selection:

(
{table.date} >= cdate(year(currentdate)-1,1,1)
and
{table.date} <= dateadd("yyyy",-1,currentdate)
)
and
(
{table.date} >= cdate(year(currentdate),1,1)
and
{table.date} <= currentdate
)

This encompasses everything you need as it defines last year up to the current date, and this year.

Then you can chop those up within the formulas you use, as in:

{table.date} >= dateadd("yyyy",-1,minimum(monthtodate))
and
{table.date} <= dateadd("yyyy",-1,maximum(monthtodate))

I'm sure you can figure out the rest.

-k
 
Thanks for the info. I will give it a shot tomorrow when I get back to work.

Should I build this in the record selection statement formula, or would it be better to use a formula field?

Paul
 
The first part is the record selection formula, the second is an example of a formula.

Read the post, the first part says record selection, the second speaks of formulas.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top