I'm creating a dashboard that shows some demographic information for a population. However, in cases where less than 25 individuals show a certain demographic trait, I need to be able to re-categorize that trait as "REDACTED" to protect privacy.
A pseudo-code version might be:
CASE
WHEN COUNT(gender) < 25 THEN "REDACTED"
ELSE gender
END
Unfortunately, this mixes aggregation and non-aggregation and isn't workable in a calculated field.
I'm hoping for some suggestions on how to solve preferably without aggregating first in the data source --I'd like to be for my data and blends to exist at the individual grain with aggregation happening within Google Data Studio.
Publicly-Editable Example Google Data Studio report
Data source (INPUT) is the source, also available here.
Expected output:
| gender | count |
|---|---|
| female | 222 |
| male | 223 |
| REDACTED | 55 |




