1 Reply Latest reply: Nov 14, 2016 3:37 PM by Sunny Talwar RSS

    calculating median with denominator restriction?

    Kristina Stephenson

      Hi All,

       

      I would like to calculate the event length of stay for patients with an event (AnyEvent indicator set to 1) within a certain number of days of discharge from a hospital.  I calculated the average event length of stay for patients with an event by discharge location the following way:

       

      Dimension: DischargeLocation

      Expression: SUM({<DayNum={"<=$(vDaysOfInterest)"}>}AnyEvent)/COUNT({<AnyEvent*={1}>}DISTINCT EventKey)

       

       

       

       

      I would also like to calculate median event length of stay *for patients with an event* by discharge location. How can I update the code below to aggregate by only patients with an event (i.e. denominator restriction {<AnyEvent*={1}>} )?

      MEDIAN(AGGR(SUM({<DayNum={"<=$(vDaysOfInterest)"}>}AnyEvent),EventKey,DischargeLocation))

       

      Thanks!!