Print Page | Close Window

Average Formula Help!

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19380
Printed Date: 08 May 2024 at 2:44am


Topic: Average Formula Help!
Posted By: crystalisfun
Subject: Average Formula Help!
Date Posted: 09 Apr 2013 at 8:48am
Hey guys...I have a crosstab I have built to give me averages of quarterly data...the only data being pulled in is for the past four quarters. In order to get the YTD numbers (as opposed to average), I had to create a simple formula of Average ({data field}, {property number}) which works fine until I try to make that average various data points that are divided by lets say number of units for example. Here's one of the formulas and it won't do the last calculation.

if {quarterly_income_statement_by_quarter.Principal Payments 1}
-{quarterly_income_statement_by_quarter.Principal Payments 2}
-{quarterly_income_statement_by_quarter.Principal Payments 3} = 0 then 0
else Average ({quarterly_income_statement_by_quarter.Total Operating Expenses},{property_information.Property Number})
- Average({quarterly_income_statement_by_quarter.Principal Payments 1},{property_information.Property Number})
- Average({quarterly_income_statement_by_quarter.Principal Payments 2},{property_information.Property Number})
- Average({quarterly_income_statement_by_quarter.Principal Payments 3},{property_information.Property Number})
+ Average({quarterly_income_statement_by_quarter.Interest - 1st Debt},{property_information.Property Number})
+ Average({quarterly_income_statement_by_quarter.Interest - 2nd Debt},{property_information.Property Number})
+ Average({quarterly_income_statement_by_quarter.Interest - 3rd Debt},{property_information.Property Number})
/ Average ({quarterly_income_statement_by_quarter.Total Income}, {property_information.Property Number})*100

The first part before "if zero then 0" is to avoid the dividing by zero issue...but if you see, I am trying to divide the total formula by "total income" in this case...and trying to turn it into a percentage. This is for breakeven occupancy. I tried adding parenthesis before the average and it keeps giving me an error. How can I get it to give me the end result? Thanks so much!!



Print Page | Close Window