Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!!
May be this:
Median(Aggr(Sum({<DayNum={"<=$(vDaysOfInterest)"}, AnyEvent*={1}>}AnyEvent),EventKey,DischargeLocation))
or
Median({<AnyEvent*={1}>} Aggr(Sum({<DayNum={"<=$(vDaysOfInterest)"}, AnyEvent*={1}>}AnyEvent),EventKey,DischargeLocation))
May be this:
Median(Aggr(Sum({<DayNum={"<=$(vDaysOfInterest)"}, AnyEvent*={1}>}AnyEvent),EventKey,DischargeLocation))
or
Median({<AnyEvent*={1}>} Aggr(Sum({<DayNum={"<=$(vDaysOfInterest)"}, AnyEvent*={1}>}AnyEvent),EventKey,DischargeLocation))