?
Solved

Crystal Last full year & YTD Last full month

Posted on 2012-04-13
11
Medium Priority
?
3,740 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
11 Comments
 
LVL 101

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 2000 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
[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

 
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 101

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 101

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 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