Just define your connection as a multiple table connection joining the three tables as you show in your query. Then you can achieve what you want with filters, parameters and calculated fields.
Thanks, I've got to the point where I have a calculated field which is the count of Encounters, but what I can't work out how to do now is count the number of encounters conditionally, based on the two parameter's I've created. Could I get an example of how this is done?
The parameters I have are the date and the number of hours, i.e. the '2010-03-01 07:00' and the 96 from above.
Create a calculated field called [Meets criteria] (say), like this:
DATEDIFF('hour', [AdmissionDate], [Date Param]) > [Hours Param]
That will return a boolean (true/false) value. Drop that field on the filters shelf and select "True".
Thanks a lot