Added median, sum to stats_by_category