Forum Discussion

jdb0912's avatar
jdb0912
New Member
3 years ago
Solved

Calculated column not referencing original entry properly

Hi everyone,   I wasn't sure how to really title the exact issue I was facing, so I explained it as best as I could below.   I'm trying to calculate bed days, then associate the insurance informa...
  • mlsx4's avatar
    3 years ago

    Hi jdb0912 

     

    First of all you should establish two inactive relationship: between Admit Date and Calendar and Discharge Date and Calendar.

     

    Then, you can calculate active beds (with this formula you also check if discharge date is empty in case the patient is still on it:

     

     

    Active beds= 
        CALCULATE(DISTINCTCOUNT('Table'[Visit ID]),
        FILTER('Table','Table'[Admit Date]<=MAX('Calendar'[Fechas]) && OR('Table'[Discharge Date] >=MAX('Calendar'[Fechas]),ISBLANK('Table'[Discharge Date]))))

     

     

     

    And now, you can display it in a matrix:

     

     

  • mlsx4's avatar
    mlsx4
    3 years ago

    Then, add a new measure:

     

    Sum of bed days= SUMX(CalendarTable,[Active beds])