Solved

Crystal Last full year & YTD Last full month

Posted on 2012-04-13
11
3,437 Views
Last Modified: 2012-04-18
have several running totals that I need to add a formula for dates and cannot figure out the syntax.

Database field:  invoicedate  
Format: mm/dd/yyyy
Formula 1: Need ability to do the following but have it put then year in dynamically so I dont have to always go in and update the year.
{oeeh.invoicedt} in Date (2011, 01, 01) to Date (2011, 12, 31)

Formula 2: Need formula to allow me to get current YTD to last full month. For example if today is 4/13/2012 it need to put the following:

{oeeh.invoicedt} in Date (2012, 01, 01) to Date (2012, 03, 31)
0
Comment
Question by:kelsanit
  • 5
  • 3
  • 3
11 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 37843514
Last year
Year({oeeh.invoicedt}) = Year(CurrentDate) - 1

This year full months
{oeeh.invoicedt} in Date (Year(CurrentDate), 01, 01) to CurrentDate - Day(CurrentDate)

mlmcc
0
 

Author Comment

by:kelsanit
ID: 37843898
one more I forgot about.

Last year full months:
for example: if today is 4/13/2012 it woudl pull the following dates

1/1/2011-3/31/2011.

I am testing the others you sent but appear to be working good! thank you
0
 
LVL 18

Accepted Solution

by:
UnifiedIS earned 500 total points
ID: 37844039
Just reduce the years by 1 like this:

{oeeh.invoicedt} in Date (Year(CurrentDate) -1, 01, 01) to DATEADD(year, -1, CurrentDate - Day(CurrentDate))
0
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
LVL 18

Expert Comment

by:UnifiedIS
ID: 37844289
If possible, mlmcc should get some of the points too, although he has plenty...
:)
0
 

Author Comment

by:kelsanit
ID: 37844568
yes, sorry about that.
 
I am having problems with the formulas and the data it is pulling. both formula 1 & formula 2 are pulling the same data\numbers

Formula 1: Year({oeeh.invoicedt}) = Year(CurrentDate) - 1


Formula 2: {oeeh.invoicedt} in Date (Year(CurrentDate) -1, 01, 01) to DATEADD(year, -1, CurrentDate - Day(CurrentDate))
0
 
LVL 18

Expert Comment

by:UnifiedIS
ID: 37844707
Where are you putting the formulas?
0
 

Author Comment

by:kelsanit
ID: 37848894
in the running total formula section.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37849104
It should be used as the record filter.

If you are using them in the evaluate when part of the running total then you need to use the formulas I provided or split the other into last year and this year to date.

This gets all the records for last year
Formula 1: Year({oeeh.invoicedt}) = Year(CurrentDate) - 1

This gets all records for last year through a year ago last month
Formula 2: {oeeh.invoicedt} in Date (Year(CurrentDate) -1, 01, 01) to DATEADD(year, -1, CurrentDate - Day(CurrentDate))

To get this year to date for full month
Formula 2: {oeeh.invoicedt} in Date (Year(CurrentDate) , 01, 01) to CurrentDate - Day(CurrentDate))

mlmcc
0
 

Author Comment

by:kelsanit
ID: 37850894
all formulas are valid except formula 2 which gives me an error

"Not enough arguements have been givent ot his function"
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37851568
Try

 {oeeh.invoicedt} in Date (Year(CurrentDate) -1, 01, 01) to DATEADD(year(CurrentDate) , -1, CurrentDate - Day(CurrentDate))

mlmcc
0
 

Author Comment

by:kelsanit
ID: 37860751
it now says a string is required here and highlights the following area in the formula

year(CurrentDate)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question