Mismatched aggregation. Custom aggregations can't contain both aggregated and nonaggregated field

I am getting an error for the below calculated field:
ifelse(
{em valid = ‘direct’,
(distinct_count({esc_id}) / distinctCountOver({esc_id}, )) * 100,
0
)
I need it to calculate the percentage of the above formula for a vertical bar chart visual if the em_valid is direct.

Hi @Made_Enny ,

You are seeing this error as you trying to divide distinct_count() derived value by DistinctCountOver().

Please try to add a min() or max() for the LAC.

e.g. : ifelse(
{em valid = ‘direct’,
(distinct_count({esc_id}) / min(distinctCountOver({esc_id}, )) )* 100,
0
)

This would allow you to do the calculation.

Thanks,
Prantika

Hi @Made_Enny

There is a nice article that explains this problem. I suggest you give it a read to understand your error better and the solution for the same.

Regards,
Giri

Hi @Made_Enny,
It’s been awhile since we last heard from you, were either of the responses above helpful regarding your case or did you still have additional questions?

If we do not hear back within the next 3 business days, I’ll go ahead and close out this topic.

Thank you!

Hi @Made_Enny,
Since we haven’t heard back, I’ll 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.

Thank you!