COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: teggett on 09 Jun 2015 07:45:00 PM

Title: Filtering subset of subset
Post by: teggett on 09 Jun 2015 07:45:00 PM
Hello all,

First time here, so be gentle.

I'm trying to run a report that attributes patients to the physician they have seen the most.  I feel like this is a rather basic problem, but for some reason I'm unable to wrap my head around how to best do this.  So here is what my data looks like:

Data Items:
Patient ID
Encounter ID
Provider ID






Patient IDEncounter IDProvider ID
111
121
132

With the eventual result of patient 1 being attributed to provider 1.  My logic is to add a data item that looks something like this:

Provider encounter count by patient
count(distinct [Encounter ID] for [Patient ID] for [Provider ID]) ****not functional, as cognos will not allow two for

after which I would filter by using:

maximum([Provider encounter count by patient] for [Patient ID])

I'm guess this is completely convoluted, so thank you in advance for any help you can provide.
Title: Re: Filtering subset of subset
Post by: Lynn on 10 Jun 2015 02:03:37 AM
Ah, we are not so terribly fierce here  ;)  welcome to the forum

You should be able to specify multiple elements in the scope by using a comma separator.

count(distinct [Encounter ID] for [Patient ID] , [Provider ID])

Not sure if this will solve your problem because I don't know what that will be like nested inside your maximum function.
Title: Re: Filtering subset of subset
Post by: teggett on 10 Jun 2015 07:54:05 AM
 :) Nailed it.  Thank you very much.  You just ended about 4 hours of research with one post.