?
Solved

Crystal Last full year & YTD Last full month

Posted on 2012-04-13
11
Medium Priority
?
3,856 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
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

649 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