Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Reine
Helper IV
Helper IV

How to determine if a certain patient type is coming back

Hi everyone - I've run into a problem I can't figure out.  I have the attached (sample) table that shows all appointments in our clinic.  From it I am trying to determine if a patient that had an iLasik appointment came back in to see us for another kind of appointment afterwards.  For example, patient #418 from the table did come back for other appointment types after they had and an iLasik appointment, but patient #2110 has not. 

 

In the end, I want to know:

1. The number of people that had ilasik appointments by month

2. Of those people each month, how many came back later and to which department

 

PatientIDAppointmentDateAppointmentDepartmentAppointmentPurpose
24508/01/184Dry Eyes
24502/19/194OD Tear Science Exam
41802/02/184OD Tear Science Exam
41812/20/184Refractive Consult
41803/01/194iLasik
41806/20/194Dry Eyes
41801/07/203Earlobe reconstruction - Bilateral
77005/03/184Elective Self Pay Exam
83407/16/182Microderm- Express
83410/31/194Contact Lenses
93103/09/184Vision Exam
102110/04/184Dry Eyes
102112/04/184Meibomian Gland Expression
102106/10/194iLasik
102107/10/193Ectropion Repair LT
106101/25/192Juvederm
124309/19/182Electrolysis, Lid Eval
124311/02/182Electrolysis
124309/06/194Refractive Consult
135308/29/194Refraction Only
136004/18/193Lid Eval
142106/20/194iLasik
154404/19/183Ectropion, Ectropion Repair LT w/Medial Spindal, Entropion
154406/21/183Ectropion Repair LT w/Medial Spindal
155904/02/183Lid Eval
169801/07/191Glasses
173805/10/194iLasik
199903/08/194Dry Eyes
203907/18/194Refraction Only
211001/11/183Lid Eval
211006/28/181Contact Lenses
211010/04/184Dry Eyes
211010/16/182HALO
211006/20/194iLasik
232601/28/202Phototherapy- Face
232906/28/194Dry Eyes
235202/26/182LHR- Lip & Chin
235204/09/182LHR- Lip & Chin
247007/16/193Lid Eval
289707/15/194Sudden Vision Loss
290409/19/194Dry Eyes
307702/23/183Browplasty
307710/05/184iLasik
307712/11/182Level 2 HALO - medium face
307706/11/194Refraction Only
311912/11/182Phototherapy- Face
314603/16/182Juvederm
314612/10/182SBP1dayface
320502/08/183Ectropion
320505/29/183Ectropion
322106/30/194iLasik
322107/30/192Visia- Front View
322111/13/192Phototherapy- Face
322111/27/192Illumination Express-Microderm
322112/11/192Phototherapy- Face
322103/20/202Phototherapy- Face
323604/19/194ilasik
324911/06/194Dry Eyes
327702/13/184PRK (Photorefractive Keratectomy)
327707/09/194Refraction Only
340910/17/193Skin Cancer Surveillance
345309/24/184Discharge
346101/24/184Dry Eyes
358305/24/183Lid Eval
358307/10/183Browplasty, Endoscopic
358301/12/194iLasik
384904/12/182Latisse
384907/06/184Dry Eyes
384910/01/184OD Tear Science Exam
384911/30/184Lid Eval
403006/29/184OD Tear Science Exam
403005/24/194Dry Eyes
403011/15/194Dry Eyes
403502/14/184Refraction Only
405907/02/194iLasik
405908/09/192Juvederm
405908/27/192Phototherapy- Spot Treat
405912/10/192Phototherapy- Face
409303/19/183Lid Eval
410503/12/182Cosmetic Consult, Lesion excision/Biopsy
410503/30/183Earlobe reconstruction - Bilateral
410505/10/192Juvederm
410506/20/192Juvederm
410507/17/192Dermaplaning

 

I hope this makes sense - thank you for the help!

 

 

 

 

8 REPLIES 8
V-lianl-msft
Community Support
Community Support

Hi @Reine ,
 
First you need to create an index column in edit queries.
test_next_department.PNG
Everything is in pbix, please refer to this pbix
 
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for your reply.  I apologize, I am still a new PBI user and though I can grasp basic DAX, I'm afraid that I can't quite understand what you've done here or see how it gives me the info I need.

 

It looks like the "next_department" shows the first department they had an appointment with after their iLasik appointment, correct?  

 

The other columns, ilasik_back and ilasik_month, I don't understand at all what they are showing.  What do the numbers in those columns refer to?

Hi @Reine ,
 
I'm sorry that I didn't explain it clearly.
"ilasik_month" is the number of people that had ilasik appointments by month.
"ilasik_back" is the number of people who came back later.
"next_department" is back to which department.
 
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

Is this what you want?  On the row labels, I have applied a filter on ILasik and on the column labels i have applied a filter on non-Ilasik.  Please confirm whether this answers your question.

Untitled.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hmm.  I would need to do the columns as departments rather than purpose because there are hundreds of purposes but somethign like this might work.  How do you filter on row labels and column labels seperately like this?

@Ashish_Mathur  hi -I think something like this might work, but I don't know how to filter like you've done.  Can you share how that is done?  Thank you 🙂

Hi,

You may download my solution workbook from here.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you!  I will give this a try next week and let you know if it's the solution.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors