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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
anwilkins
Resolver II
Resolver II

Locate patients with only one visit

I need to create a follow-up with patient roster that displays all patients within a date range who have only had 1 visit / appointment.

My hope was to create a calculated column that displayed the number of visits for each patient then create another column that was a is a flag for people with only 1 visit. Here is the dax I'm using to create the first column...its NOT working...it displays all visits per patient

*PatientsWithOneVisit = CALCULATE(DISTINCTCOUNT(MERGE_PatientData[patientid]),

FILTER(VALUES('MERGE_PatientData'[service date]),CALCULATE(COUNTROWS('MERGE_PatientData')=1)))

The end goal is a tabular roster

Patient ID     Name     Last Service Date     Visit Count     Red Flag (for 1 visit)

00110011     Morris      2/01/2022                   6                  

00220033     Jones      12/01/2021                  1                         X

00110044     Stevens   10/01/2022                 3                  

00220022     Albre      04/01/2021                  1                         X

 

1 ACCEPTED SOLUTION
anwilkins
Resolver II
Resolver II

Unfortunately as this is medical data I cannot share the file. However, a work around has been put into place so I will mark this as closed.

Thanks

View solution in original post

5 REPLIES 5
anwilkins
Resolver II
Resolver II

Unfortunately as this is medical data I cannot share the file. However, a work around has been put into place so I will mark this as closed.

Thanks

v-shex-msft
Community Support
Community Support

Hi @anwilkins,

Can you please share a pbix or some dummy data that keep raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Notice: please remove sensitive data before sharing.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
anwilkins
Resolver II
Resolver II

Hi Datavisuserpbi, I tried this and the results are blank

*Count v4 = IF(CALCULATE(SUM(MERGE_PatientData[Service Date]), GROUPBY(MERGE_PatientData,MERGE_PatientData[PatientId])) = 1, "X","")
 

Hello,

 

Try this:

column= IF(CALCULATE(SUM('Table'[Visit Count]),GROUPBY('Table','Table'[Name]))=1,"X"," ")
 
!!

 

PaulDBrown
Community Champion
Community Champion

Can you please post sample data of the fact table or a sample PBIX file (hopefully...)?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors