Hello, the below formula returns “Mismatched aggregation. Custom aggregations can’t contain both aggregated and nonaggregated fields, in any combination.”
I want if the company is 6405 and the calendar is 2025 to show the max of the subscription_eur_revenue else to show the sum of subscription_eur_revenue
ifelse(max({company_id}) = 6405 AND (extract(‘YYYY’, calendar) = ‘2025’), max({subscription_eur_revenue}), sum({subscription_eur_revenue}))
Hello @pantelis Hope this message finds you well!!
In Amazon qs, mismatched aggregation error occurs when you mix aggregated and non aggregated fields in a single expression.
My suggestuib, ensure consistent aggregation throughout the expression. For your case, create two separate calculated fields: one for the max when the condition is true and another for the sum when false.
Create a calculated field for the max when the condition is true:
ifelse({company_id} = 6405 AND extract('YYYY', {calendar}) = '2025', {subscription_eur_revenue}, NULL)
Create another calculated field for the sum when the condition is false:
Hi @pantelis,
It’s been awhile since we last heard from you, did you have any additional questions or was the solution provided above sufficient to assist with solving your case?
If we do not hear back within the next 3 business days, I’ll close out this topic.
Hi @pantelis,
Since we have not heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.