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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Njoo
Regular Visitor

Find number of patients who readmitted within 30 days

Hi everyone,

 

I am trying to find the number of patients who were readmitted to the hospital within 30 days after they were discharged previously. I have The admissions table with the columns (Patient No, admission date, discharge date, bed, ward... etc) Do you guys have any idea about how to do that?

 

Tank you.

1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

try this code for calculated column - it returns true whenever the admission date for a patient is less than 30 vs their last discharge date

Column =
VAR CurrentPatientNo = 'Table'[Patient No]
VAR CurrentAdmissionDate = 'Table'[Admission date]
VAR PreviousDischargeDate =
    CALCULATE (
        MAX ( 'Table'[Discharge date] ),
        FILTER (
            'Table',
            'Table'[Admission date] < CurrentAdmissionDate
                && 'Table'[Patient No] = CurrentPatientNo
        )
    )
RETURN
    IF (
        PreviousDischargeDate = 0,
        FALSE (),
        IF ( CurrentAdmissionDate - PreviousDischargeDate <= 30, TRUE, FALSE () )
    )


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

9 REPLIES 9
Stachu
Community Champion
Community Champion

try this code for calculated column - it returns true whenever the admission date for a patient is less than 30 vs their last discharge date

Column =
VAR CurrentPatientNo = 'Table'[Patient No]
VAR CurrentAdmissionDate = 'Table'[Admission date]
VAR PreviousDischargeDate =
    CALCULATE (
        MAX ( 'Table'[Discharge date] ),
        FILTER (
            'Table',
            'Table'[Admission date] < CurrentAdmissionDate
                && 'Table'[Patient No] = CurrentPatientNo
        )
    )
RETURN
    IF (
        PreviousDischargeDate = 0,
        FALSE (),
        IF ( CurrentAdmissionDate - PreviousDischargeDate <= 30, TRUE, FALSE () )
    )


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

This solution is not working for me, any reasons why?

Thank you for this! I am needing to find the index/initial visit, any advice on how I would do that? Thanks in advance

thank you, it works!

What about if I wanted to add a condition to calcuate this only for patients re-admitted through Emergeny? where Admission Method= Emergengy Patient (to calculate Unplanned Readmissons)

P.S. No restriction on discharge date.

 

Thanks in advance!

Stachu
Community Champion
Community Champion

@OhoodK that would be something like this:

 

Column =
VAR __CurrentPatientNo = 'Table'[Patient No]
VAR __CurrentAdmissionDate = 'Table'[Admission date]
VAR __PreviousAdmissionDate =
    CALCULATE (
        MAX ( 'Table'[Admission date] ),
        FILTER (
            'Table',
            'Table'[Admission date] < __CurrentAdmissionDate
                && 'Table'[Patient No] = __CurrentPatientNo
        )
    )
RETURN
    IF (
        'Table'[Admission Method] <> "Emergency Patient",
        FALSE (),
        IF ( __PreviousAdmissionDate <> 0, TRUE (), FALSE () )
    )

 

 



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Hi, I tried to use the above code to estimate the readmission > 28 days, but it only gave me true/ false response. The code I used is below:

READMIT28 =
VAR CurrentPatientNo = 'LMR_0405_2021_by First cancer'[Ptcount]
VAR CurrentAdmissionDate = 'LMR_0405_2021_by First cancer'[ADMISSION COUNT]
VAR PreviousDischargeDate =
CALCULATE (
MAX ( 'LMR_0405_2021_by First cancer'[SEPDATE] ),
FILTER (
'LMR_0405_2021_by First cancer',
'LMR_0405_2021_by First cancer'[ADMDATE] < CurrentAdmissionDate
&& 'LMR_0405_2021_by First cancer'[state_linkage_key] = CurrentPatientNo
)
)
RETURN
IF (
PreviousDischargeDate = 0,
FALSE (),
IF ( CurrentAdmissionDate - PreviousDischargeDate <= 2, TRUE, FALSE () ))
 
BMANEZHI_0-1651126619931.png

 

 I would like the number of patients readmitted within 28 days. The other point is that the code is only accepting measures for the first two lines (highlighed in blue below). So I had to replace the actual patient IDs with ptcount and admission date with admission count, which may have caused the problem. It would be great if you could provide a solution. Thanks in advance
VAR CurrentPatientNo = 'LMR_0405_2021_by First cancer'[Ptcount]
VAR CurrentAdmissionDate = 'LMR_0405_2021_by First cancer'[ADMISSION COUNT]
 

Many thanks!

This is great! Thank you for solving. 

Njoo
Regular Visitor

It's working thanks a lot! 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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