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!

Removing Duplicates, but need to sum on distinct records

Status
Not open for further replies.

thomasgill

Technical User
Jul 20, 2010
3
US
Hello.

I am building and running reports based on medical records.
The report I am working on requires me to pull the most recent value for a test given to a patient, and place it into a range of values.
Then I need to sum the total of patients whose last test value was within range a, range b, and range c.

All of this has been easy enough.
The select expert only chooses the result with the maximum date, but there are duplicates.
I have the "select distinct records" box checked.

The linking is as follows.

PERSON links to OBS and to PROBLEM

I tried changing the linking to (with no avail)
PERSON links to OBS
OBS links to PROBLEM

I cannot simply suppress the duplicates, because I have to count the number of patients whose last value was in a specific range.

I am using CR 2008.

Thanks in advance.
 
I realized that I could also only evaluate the running total if:
the value is in the specified range and the group changes.
However I am unsure how to use both of these at the same time in the running total formula.
 
I was able to work around the problem, but I'll leave the solution here for future reference.

In the running total evaluation formula,
evaluate if Next({Patient.Searchname})<>{Patient.Searchname}
 
If you are trying to evaluate the last record in a group based on searchname, then you should add a clause to capture the last record, as your formula will not evaluate when there IS no next record. Try:

onlastrecord or
Next({Patient.Searchname})<>{Patient.Searchname}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top