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

CR XI - using distinct count in formula?

Status
Not open for further replies.

madsstiig

Technical User
Jun 11, 2008
50
DK
Hi. I'm doing this report in CRXI that should show exams with a certain procedure code ({VWDEPSTAT.RESCODE}="UXRD45") but I only want the exams that has got only that exact procedure code (as in DistinctCount ({VWDEPSTAT.RESCODE} = 1).
How can I do that? When I try to CR informs me that 'the function cannot be used because it must be evaluated later'.
Can you please help me with this?
Best regards Mads, Copenhagen, Denmark.
 
Allow all values into the report (don't select on the field), and then instead, use group selection (report->selection formula->group) and enter this:

distinctcount({VWDEPSTAT.RESCODE},{table.groupfield})=1 and
{VWDEPSTAT.RESCODE} = "UXRD45"

I'm assuming you are tyring to select patients or some group using these criteria.

Note that if you then want to do calculations across groups, you need to use running totals, since non-group selected records are still "in" the report, though not displayed, and would contribute to the more usual summaries.

-LB
 
That sounds fairly reasonable ... I just don't know what the groupfield is/should be. I have never worked with group selections... :-(
Can you please specify? Or do you need more info on the DB or table?
Regards...
 
I am guessing that you are trying to identify a set of patients or something that have only had this one procedure. In this case, the group field should be the patient ID or something like that. You should be grouping on whatever field identifies the set that you want to check.

-LB
 
Now I may understand it:
I used group expert to group by {VWDEPSTAT.DID} (patient ID) and inserted this in the group selection:
distinctcount({VWDEPSTAT.RESCODE},{VWDEPSTAT.DID})=1 and {VWDEPSTAT.RESCODE} = "UXRD45"
... but I still get exams with more than this single RESCODE.
What am I missing?
Regards :)
 
I guess you are getting patients that have the same procedure UXRD45 twice and you only want those who have had it once? Then remove the "distinct":

count({VWDEPSTAT.RESCODE},{VWDEPSTAT.DID})=1 and {VWDEPSTAT.RESCODE} = "UXRD45"

And I'm assuming you are referring to what is appearing in the detail section and that you are not using a crosstab or chart.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top