Mismatched aggregation issue

I wanted to create a last month calculate field to get otp number from last month. My OTP formula is sum(otp_num)/sum(otp>denom).

Got an error message for mismatched aggregation. how can I fix this? thank you

can you try combining it and summing it outside of the ifelse.


thanks max, sum(ifelse(dateDiff(date2,${asofdate},“MM”)=1,{opt_num},0))/sum(ifelse(dateDiff(date2,${asofdate},“MM”)=1,{opt_denum},0)) this works!