Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do not want to average suppressed data!

Status
Not open for further replies.

kcuffel

Technical User
Oct 29, 2010
1
US
I am trying to chart the average of the first few records of a group (I have grouped my data by location and then by appointment date). I have created a formula (Pt in Rm Ontime) that gives the the difference of the patient's scheduled appointment time and the time the patient was brought into the room to be seen. I would like to average this formula for only the first appointment times of the day to determine if we are starting the day on time. I have tried multiple ways to remove the extra data that I dont want averaged so that I can add my formula (Pt In Rm Ontime) to the chart in the "Show Value" section of the chart. I would like to chart my data by each employee, so I will be placing the employee field within the "On Change of" section of the chart.

I have tried to remove the extra data by creating a running total that labels the beginning apppoitments of the day as a 1 and any later appointment is greater than 1. I have then suppressed the details section if the running total is greater than 1. When I attempt to average this data within the chart, even the suppressed data is still factored into my average. Please help!
 
kcuffel

If already have flagged the appointments you wish to average, I would think you just need to reference this in another formula field.

Syntax may not be 100%, my apologies.
{@Average_Reset}
WhilePrintingRecords;
Shared NumberVar FirstApptCounter:=0;
Shared NumberVar FirstApptDurations:=0;

{@Average}
WhilePrintingRecords;
Shared NumberVar FirstApptCounter;
Shared NumberVar FirstApptDurations;

If {@YourRTFormula} = "1" THEN
(
FirstApptCounter:=FirstApptCounter+1;
FirstApptDurations:=FirstApptDurations+{@CurrentApptDuration}
)

{@Average_Display}
WhilePrintingRecords;
Shared NumberVar FirstApptCounter;
Shared NumberVar FirstApptDurations;
Shared NumberVar Average;

Average:=FirstApptDurations/FirstApptCounter

The "Reset" would go in the Header, the Running Total in the details and the "Display" in the Footer.

I hope this helps!


Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
It is easier to use a Running Total with a formula, much less coding. The use of Crystal's automated totals is outlined at FAQ767-6524.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 11.5 with SQL and Windows XP [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top