Mismatched aggregation. Custom aggregations can’t contain both aggregated and nonaggregated fields, in any combination HELP

i want to create a segmentation for my customer based on three things:

  1. Days since last purchase (This comes from a query that has user_id, min(day_since_last_purchase) from X) – i need to do the min because there are multiple profiles per user and i want to know the min per user regardless the profile
  2. % change in communications MoM (this comes froma. query that has the following info user_id, date_, q_communications)

I want the following groups:

  1. if % change in communications >0 and days since last login>7 then group A
  2. if % change in communications >0 and days since last login<7 then group B
    3.% change in communications <0 and days since last login>7 then group C
  3. % change in communications <0 and days since last login<7 then group D

so i try the followoging

ifelse(% change in communications <0 and days since last login<7,“Group D”,
% change in communications >0 and days since last login<7,"Group B, …)

however when i do the ifelse function i need to aggregate non-aggregated with aggregated fields so i keep receiving the error: " [Mismatched aggregation. Custom aggregations can’t contain both aggregated and nonaggregated fields, in any combination)"

Any ideas? Thanks!

Any ideas?

Hi @pilar - I will try this out in my environment later today. If the grouping is not possible in QuickSight you can add a new field in the data prior to visualizing it in QuickSight.

Are you querying the data sources live, or you’re using SPICE?

1 Like

Hi @pilar

We have not heard back from you regarding your question. We would still like to help. If we do not hear back in the next 3 days, we will archive the question.

Try to use minOver with PRE_AGG instead of min. I think that should get rid of your mismatched aggregation error.