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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct Count of First Cases in a Room

Status
Not open for further replies.

Jonathan212

IS-IT--Management
Oct 22, 2002
57
US
My objective is to total the number of first cases in a room.

Formula to derive first case in a room (in selection formulas, group selection):
{pcmOpTime.timePatientInRoom} = minimum ({pcmOpTime.timePatientInRoom},
{pcmORroom.orName})

That formula is working perfectly.

Output:
surgDate orName SchedinRoom ActualinRoom Variance case number
4/2/2007
04/02/2007 AS 1 8:00 8:23 -23.00 138,761
04/02/2007 AS 2 8:00 8:10 -10.00 138,704
04/02/2007 AS 3 8:00 8:00 0.00 140,712
04/02/2007 AS 4 10:00 9:51 9.00 140,127
04/02/2007 AS 5 8:00 8:10 -10.00 140,888

I wish to total the number of first cases (and only first cases) for that day, i.e., five cases and then do a formula for the average time a case was late. I am fairly certain I can do the average formula but I can’t get the syntax yet for showing only five cases on this day. I have done a distinct count on case number, but that yields 22, which were the total cases on that day.

I am using CR10. Thanks in advance, Jonathan.
 
Hi Jonathan,

I use to do programming on an OR System as well. If I'm understanding you correctly, you are basically trying to take the first case for each OR room and see how late they were in starting for the day? If this is the case, I would suggest using a shared variable to help with this. Do you need to restrict any specific rooms? If you have just 5 rooms and 22 cases for the day, I think we can find a way to do this. Let me know if I'm understanding you correctly.

glthornton
 
Jonathan,
My suggestion would be to take the value in your Variance field and add them to shared variable which will just tally these values together. Then create another formula to take your shared variable and divide (/) by 5 and put this field in your Group Footer section. Make sure you manually check this process to ensure its accuracy.

glthornton
 
Thank you in advance for your help on this, glthornton.

In the example I cited above, I only really care about the first cases in the room. As such, I wish to divide -34 (the sum of the variances) by 5 to arrive at 6.8 minutes.
The sum of the variances as well as the total number of cases will vary, of course, each day.

Again, my thanks for yoru help.
 
Hey Jonathan,

Here is how I would approach this. I know I mentioned using a shared variable, but the below suggestion should provide you with the same result.

1. Create a formula such as "Variables Reset", which will ensure that your variables are cleared prior to the report actually running. Inside, put the following code:

Code:
NumberVar VarianceAccum := 0;

Place this new field in your Report Header and then Suppress the field so it does not show up when you print the report.

2. Create another formula called "Variance Accumulator". Inside, put the following code:

Code:
NumberVar VarienceAccum:=VarianceAccum+Variance

Place this new field in your Group Header section and then Supress this field as well, as you only want it to do the calculations behind the scenes.

3. Create another formula called "Variance Total". Inside, put the following code:

Code:
TotalVariance:=VarianceAccum/5

Place this new field in your Group Footer section.

Try that.

Glenn
 
Thanks, Glenn for helping me and walking me through this.
I sense that I am on the verge of success, but am not quite there yet.

I received an error message "not enough arguments have been given to this function" for the Variance Accumulator formula (see your note above).

Also, for the Variance Total fomula, the dividing by 5 will not work in all instances because 5 (operating rooms) is not always a fixed number. I can do a running total or some other formula though, I think, to identify number of operating rooms that had first starts each day and use that in your variance total formula.

Again, ny sincere thanks for your efforts. Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top