The sample already shows a subtle grouping issue: “United States, Philippines” becomes its own group. If the intent is titles per individual country, expand country with CROSS JOIN LATERAL unnest(string_to_array(country, ',')) AS c(name), group by trim(c.name), and use COUNT(DISTINCT show_id) if duplicate title IDs are possible. I work on SqlOtter. Its table-grid Content Filter is useful for spotting comma-separated values in the loaded rows before writing the query. The split and counts should run in SQL across the dataset.