Search code examples
crystal-reportssum

How to divide a running total


I'm on a windows 7 pro 64-bit pc using Crystal Reports 13 sp 5.

I created a formula called @days that does a datediff on a startdate and enddate. Then I did a running total called total_days to sum @days for each record (record 1 = 30 days, record 2 = 198 days...), now I need to divide total_days by 6. I tried creating a formula called credit_days with the following formula Sum ({@days_on_job}, {EMPLOYMENT.START_DATE}, "weekly")\6 but that didn't work.

Any suggestions?


Solution

  • Meg, it sounds like what you are after is a "Running Average". If so, you are close. Just divide your running total by the current record number, like this :

    {#Total_Days} /  RecordNumber