count_cases function

Convert data on the report level to aggregated data.