Jump to content

Struggling with OnTime Calculation for Summary


This topic is 4308 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I'm obviously brain dead today (and the past week). This has got to be a very simple calculation, but I just can't see it at the moment.

On each record I have:

a field "OnTime" that displays either "Yes" or "No"

On the summary in preview after sorting by customer:

a summary field that counts the number of "OnTime" fields and displays in the customer summary as "Flights"

Here is my problem: I want a field that simply calculates the number of "Flights" that were "OnTime" and display as a percentage.

Answer=On Time Flights/Total Number of Flights.

If I had 9 flights total and 4 were ontime, it would be x=4/9 or x=.44

I'm trying to write a calculation that will, after sorting by each customer, divide the number of "Yes" OnTime flights by the Total number of Flights the customer had.

The goal is to have a field that displays a percentage. On each customers summary it might have something like, Flights:50 OnTime:90%

(That would be x=45/50 and the answer displayed as a percentage.)

Does this make sense because I'm struggling with this. It's got to be easy, but I'm just not seeing it and would really appreciate a shove in the right direction. Thanking all in advance.

Link to comment
Share on other sites

First of all, since your OnTime field seems to only hold a "Yes" or a "No", I would suggest making it a number field, and using the number 1 (true) to mean the flight was on time, and either 0 or empty (false) to mean the flight was not on time.

With this setup, the calculation becomes simple. Make a new calculation field in your customer file. Have the calculation be

sum( Flights::OnTime ) / Count( Flights::ID )

Put the field on your layout in a sub-summary when sorted by the Customer ID, and format it to appear as a percentage.

Link to comment
Share on other sites

On each record I have:

a field "OnTime" that displays either "Yes" or "No"

On the summary in preview after sorting by customer:

a summary field that counts the number of "OnTime" fields and displays in the customer summary as "Flights"

This part doesn't make sense. A summary field counts all non-empty values; if the field contains either "Yes" or "No", all records will be counted. Perhaps you are sorting by customer AND by OnTime?

I'm trying to write a calculation that will, after sorting by each customer, divide the number of "Yes" OnTime flights by the Total number of Flights the customer had.

You can define a summary field as fraction of total.

Link to comment
Share on other sites

  • Newbies

Thank you to both who replied. Having looked at both responses, I did change from a "Yes" "No" to a "1" "0", and used the Sum calc and got what I needed. In the second response by "comment", my summary field was incorrect. I used the information from both suggestions and I thank you both.

Link to comment
Share on other sites

This topic is 4308 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.