4 Replies Latest reply: Aug 17, 2016 5:24 AM by Joerg Linder RSS

    Calculate Median from grouped data

    Joerg Linder

      Dear all,

       

      I would like to calculate the median value  for each prescription ID as well as for each patient ID regarding product sales (see attached data example). 

       

      I can calculate the average value for each patient by using "Sum([Sales per prescripton line])/Count(distinct(PAT_ID))".

       

      I can calculate the median value of the prescription line but how do I get the median value for prescription ID and patient ID?

       

      Thanks for your help.

       

      Jörg