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
jonnyA
Responsive Resident
Responsive Resident

Create a Readmission Formula that only brings back accts where there was a readmission w/ in 90 days

For this report I need to show a table that has patients listed that have been discharged and then ReAdmitted within 90 days.  So the formula that is created will only bring back accounts where a patient was readmitted 90 days from discharge.

Discharge Procedure Codes = 99238, 99239

Readmission Procedure Codes = 99221, 99222, 99223 

For this report I need to show a table that has patients listed that have been discharged (specific CPT codes are discharge codes) and then readmitted (specific CPT codes are readmit CPT codes) within 90 days.  

I will have to use CPT codes and Dates of Service to see if this is possible to calculate.  

First I think I need to create 2 formula that highlights that will display the Discharge and Readmisson Codes.  The Field Name is “Procedure Code”

Then, I need to create a formula that brings back patients that have Readmission Dates of Service 90 days from the Discharge.

I have sample data but i do not know how to attach?

If the formula is created correctly, then I wouldn’t think the highlighted accounts would make the report because the Date of Service are over 30 days.

Here are the Fields in Play ...

  • Test Discharge Dataset
  • Patient First Name
  • Patient Last Name
  • DOS
  • Procedure Code 

I Wouldnt think the highlighted would make the report since the Dates of Service are over 90 daya apart.

 

jonnyA_0-1627320651174.png

 

7 REPLIES 7
v-kelly-msft
Community Support
Community Support

Hi  @jonnyA ,

 

Create a measure as below:

Measure = 
var _Readmissiondate=CALCULATE(MAX('Table'[DOS]),FILTER('Table','Table'[Patient_First_Name]=MAX('Table'[Patient_First_Name])&&'Table'[Procedure Code] in {99221, 99222, 99223}))
var _Dischargedate=CALCULATE(MAX('Table'[DOS]),FILTER('Table','Table'[Patient_First_Name]=MAX('Table'[Patient_First_Name])&&'Table'[Procedure Code] in {99238, 99239}),DATESINPERIOD('Table'[DOS],_Readmissiondate,90,DAY))+0
Return
IF(MAX('Table'[DOS])=_Dischargedate,1,BLANK())

And you will see:

vkellymsft_0-1627527552970.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

@v-kelly-msft ,

Thank you so much for your response and all the work you put into that formula!  Greatly appreciated!  

I'm looking at your sample file and Bart should not be on here because his Admission DOS (99223) is 5/18/20 and his Discharge DOS (99239) is 10/20/20.  That span is well over 90 days.

 

My dataset goes blank when Input the formula you provided.  One difference i noticed from my dataset to yours is that  Your "Procedure Code" Field has the "E" and mine doesnt not have the "E".  Not sure if that has anything to do with my formula not working?

Hi @jonnyA ,

 

Check the rows where my measure =1,I just wanna show you the measure result that's why I didnt filter out Bart,if you go to filter pane,and select measure is not blank,then you wont see Bart.

Could you pls show me your .pbix file if you still have troubles working it out?Remember to remove the confidential information.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

@v-kelly-msft , I cannot figure out how to insert a demo file?  I created a new file I would like to send you but I dont know how?

 

Maybe provide your email address? 

Hi @jonnyA ,

 

Could you pls first upload it to a cloud service then share a public link with us?

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

 

amitchandak
Super User
Super User

@jonnyA , Prefer to create a new column

 

Patient Name = [Patient First Name] & " " & [Patient Last Name]

 

Create measures like these with help from date table joined with DOS

Discharge = countrows(filter(Table, Table[procedure] in {99238, 99239}))

 

Rolling 90 = CALCULATE(countrows(filter(Table, Table[procedure] in {99221, 99222, 99223 })),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),90,DAY))


readmission = countx(values(Table[Patient Name] ), if(not(isblank([Discharge])) && not(isblank([Rolling 90])) , [Patient Name], blank()))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

I cant get any of those formula's you sent to work.  😕

jonnyA_0-1627327375354.png

 

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.