Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: averging data over a 3 month period Post Reply Post New Topic
Author Message
remintgon
Newbie
Newbie


Joined: 07 May 2008
Online Status: Offline
Posts: 4
Quote remintgon Replybullet Topic: averging data over a 3 month period
    Posted: 07 May 2008 at 11:41am
I am trying to generate a rolling 3 month average of data based on the report date. So if I ran a report on say May 15th it would grab the data and give the average amount used for May, June and July.

The data I am pulling from is based on per month usage.
QTY_USAGE_MO_01
QTY_USAGE_MO_02
QTY_USAGE_MO_03
QTY_USAGE_MO_04
QTY_USAGE_MO_05
QTY_USAGE_MO_06
QTY_USAGE_MO_07
QTY_USAGE_MO_08
QTY_USAGE_MO_09
QTY_USAGE_MO_10
QTY_USAGE_MO_11
QTY_USAGE_MO_12

I am using a start date and end date parameter.

Any help would be appreciated.

Thanks.
Edit/Delete%20Message
Thanks for everything
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 07 May 2008 at 12:28pm

I think I would assign each of the monthly amounts to an array. Then use the current month to get the index of the proper element in the array and add up the following two months to it. Then divide by three. The tricky part will be at the end of the year where you have to add logic so that the summary amount starts back at the beginning of the year for however many remaining months there are in the formula.

I have extensive coverage of arrays and creating formulas in chapters 5-7 in my Encyclopedia book. You can click on the banner below to find out more information.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.018 seconds.