Ifelse but return column name

Hi everyone,

Hope you’re fine!

I’m trying to use the ifelse function that counts the number of buildings in a region and if the number is greater than 1 use the region column, but if not then use the building column.

Right now I have this logic: ifelse(distinct_count({buildings}) > 1, {region},({building})

But I get a Mismatched aggregation. Custom aggregations can't contain both aggregated and nonaggregated fields, in any combination. error.

Hi @bunmis

Could you please try the following calculation.

Example: (Note - Replace fields from your dataset)

ifelse(distinctCountOver({Category}, [Region], PRE_AGG) > 1,Region,Category)

Thanks so much! This solves my issue

1 Like