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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First day of month without using MonthToDate 1

Status
Not open for further replies.

crachic

Technical User
Dec 27, 2007
46
US
I am using Crystal XI.

I am trying to calculate the number of episodes that the admission date falls within a month to date (MTD) and a year to date (YTD) range. The difference here is that I want it to calculate the MTD and YTD totals based on a date entered by the end user and not the CurrentDate of the system.

For example. Todays Date is 5/12/08. The user enters 5/5/08. I want it to calculate the MTD totals from 5/1/08 - 5/5/08 and the YTD totals from 1/1/08 to 5/5/08.

I am needing a formula that I assume goes something like this.

{admission_date} in (First of Month) to {?Date entered by user}

I know how I am going to do the counting of the episodes but am unsure of how to accomplish the MTD and YTD scenario.

How can I accomplish this?

-crachic
 
//{@MTD}:
if {admission_date} in date(year({?EndDate}),Month({?EndDate}), 1) to {?EndDate} then 1

//{@YTD}:
if {admission_date} in date(year({?EndDate}),1, 1) to {?EndDate} then 1

You would then insert sums, not counts, on these formulas. This assumes that you have no row inflation.

-LB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top