Count of Distinct IDs when they appear multiple times within a selected time period
I have a transactions table which includes the columns: date, customer_id and order_id. I want to be able to count the distinct customer_ids within a date range when those customer_ids appear across multiple rows (because they have multiple orders within that date range.
It's easy to get a distinct count of customer_ids for the date range, but I'm struggling with how to essentially filter down to a distinct list of those ids who appear on 2 or more rows.
I was trying to use CASE WHEN .... THEN but I can't say, count_distinct( CASE WHEN count(customer_id)>0 THEN customer_id END)
Any help would be gratefully received. Hopefully I'm overthinking this!