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

I am getting the error when I try to run the calculation below. What’s the alternative please
ifelse({countryname} = ‘Malaysia’,
sum({five_sec}) / sum({total}),
sum({five_sec}) / (sum({total}) - sum({attempted}))
)

Hello @Ciku !

I found this article very helpful when trying to trouble shoot that error:

Let me know if this helps!

Hello @Ciku !

Were you able to take a look at the blog I linked above, and if so were you able to resolve the issue above?

No, and I am still facing the same issue with another formula.
I have the following formula
ifelse(dateDiff(datevalue,now(),“MI”) <61, count(paymentID),0).

I have tried to create a separate calculated field for total count count(paymentID)=
and replaced it on the formula to become ifelse(dateDiff(datevalue,now(),“MI”) <61, total count,0). but it’s still not working.