Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Year to Date Calculation with two date fields. Post Reply Post New Topic
Author Message
mrpatak
Newbie
Newbie


Joined: 01 Mar 2013
Online Status: Offline
Posts: 2
Quote mrpatak Replybullet Topic: Year to Date Calculation with two date fields.
    Posted: 05 Mar 2013 at 4:46am
Hi all,
Little bit new to Crystal (using XI), so bear with me. I have a Access database that includes two different dates for every data piece. Each one has a date for the month the data is collected, and the month that the data is reported (eg. a month could be collected for November, but not reported until January).
The report generated graphs many different sets of data, sorted on which goal they pertain to.
I need a way to summarize this data for a year to date calculation without specifically designating a year. Ideally it would look at the most recent month (collection date) and give the year-to-date for that year. They can be either an average of the data set, a sum of the data set, or an average of the percentage of the data set.
I've tried setting up something to this effect:

{@Datayear}:
DatePart("yyyy",{table.data_collected_month})

Then using that as a selection part of a summary field:
{#YTDVolume}:
Field to Summarize: table.numberofcases
Type of summary: Sum
Use a Formula:
{table.data_collected_month} >=Date ({@Datayear},01,01)
On change of group: table.goal#

But this doesn't seem to work.
Any help would be appreciated!

Edited by mrpatak - 05 Mar 2013 at 4:46am
IP IP Logged
mrpatak
Newbie
Newbie


Joined: 01 Mar 2013
Online Status: Offline
Posts: 2
Quote mrpatak Replybullet Posted: 07 Mar 2013 at 5:02am
Eventually got a fix for this using the Maximum and DateDiff functions.
Originally posted by mrpatak

Use a Formula:
{table.data_collected_month} >=Date ({@Datayear},01,01)

Updated this field to:
DateDiff("yyyy",{table.data_collected_month},(Date (Maximum ({table.data_collected_month}, {table.goal_id})))) < 1
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.