Solved

Crystal Last full year & YTD Last full month

Posted on 2012-04-13
11
3,262 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
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now