cancel
Showing results for
Did you mean:
New Member

Subcategory analysis

Background:

I have the following table.

One patient is touched by several doctors (A, B, C) who perform various procedures (PA5, PA8, PA9, PA13). Usually PA13 precedes other ones, but not always, other procedures can occur independently.

Question:

We want to know the how good Doctor A is when he performs procedure PA13.

Specifically, for all of Doctor A’s patients, how many of those patients end up receiving PA8 or PA9 procedures by any doctor.

I have provided manually filtered excel file data; obviously, I would like to achieve this result in PBI .

Here is the main report that we want to analyze:

 Doctor Patient Procedure A 1 PA13 A 1 PA8 A 2 PA9 A 3 PA13 B 3 PA5 B 3 PA8 A 4 PA5 B 4 PA13 C 4 PA8 A 5 PA8 B 6 PA13 C 6 PA9 A 7 PA13 A 7 PA9

I would like to

Select cases seen by Doctor A

 Doctor Patient Procedure A 1 PA13 A 1 PA8 A 2 PA9 A 3 PA13 A 4 PA5 A 5 PA8 A 7 PA13 A 7 PA9

Then calculate how many of these patients Procedure PA13( see  Patients 1,3,7)

 Doctor Patient Procedure A 1 PA13 A 1 PA8 A 2 PA9 A 3 PA13 A 4 PA5 A 5 PA8 A 7 PA13 A 7 PA9

Then analyze how many of these cases had PA8 or PA9 outcome, irrespective of doctor.

 Doctor Patient Procedure A 1 PA13 A 1 PA8 A 2 PA9 A 3 PA13 B 3 PA5 B 3 PA8 A 4 PA5 B 4 PA13 C 4 PA8 A 5 PA8 B 6 PA13 C 6 PA9 A 7 PA13 A 7 PA9

Sincerely

Hasan

5 REPLIES 5
Community Support

Hi, @HYousuf ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support

Hi, @HYousuf ;

You could create measure as follow:

``PA13 COUNT = CALCULATE(COUNT('Table'[Patient]),FILTER(ALLSELECTED('Table'),[Doctor]=MAX([Doctor])&&'Table'[Procedure]="PA13"))``
``````PA89 count =
var _pa13=SUMMARIZE(FILTER('Table',[Procedure]="PA13"),[Patient])
return COUNTROWS(SUMMARIZE(FILTER('Table',[Patient] in _pa13),[Patient]))``````

The final output is shown below:

If it is not correct, please share the scene you want to output (screenshot display)
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Super User

You can create a measure as below

`Patient Outcome =var patients = CALCULATETABLE(    VALUES( 'Table'[Patient] ),    REMOVEFILTERS( 'Table' ),    TREATAS( { ( SELECTEDVALUE('Table'[Doctor] ), "PA13" ) }, 'Table'[Doctor], 'Table'[Procedure] ))return CALCULATE( DISTINCTCOUNT( 'Table'[Patient] ),     REMOVEFILTERS( 'Table' ),    patients,     TREATAS( { "PA8", "PA9" }, 'Table'[Procedure] ))`

then create a table visual with Doctor and this measure as values

New Member

Good morning Parry:

We want to evaluate Dr. A's patient outcome.

Specifically, if Dr. A performs PA13 procedure, then how many of those patients end up going through PA8 or PA9 procedures. (These latter PA8, PA9 procedures could be done by ANY doctor including but NOT limited to Dr. A).

Looking forward to a solution.

Super User

@HYousuf thanks for the detailed explanation but it is not clear what end result do you want to achieve?

Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤

Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Announcements

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Top Solution Authors
Top Kudoed Authors