Include division in ifelse calculation

i want to have a calculated filed
if metric name in (OTD, OTP, Storefront availbility) then (num/denom) else num

my current formula is ifelse(in({metric_name},[“OTD %”,“OTP %”,“Storefront Availability %”]),sum({metric_numerator}/sum({metric_numerator}),sum({metric_numerator}))

but i got this error: mismatched aggregation. can someone let me know how to achieve the result i want? thanks

Hi @Iris_Zhou ,
did you tried it without the sum()?
BG

hi @ErikG without sum, the result is not correct

both metric_num and metric_denom are binary value(1/0)

But is the formula working?

hi Erik, your formula didn’t work, this formula works for my case if anyone in the future has the same question

ifelse(

sumIf(0,in({metric_name},["offer_count","title_count"]))=0,toString(sum({metric_numerator})),

concat(

toString(round(sum({metric_numerator}*100)/sum({metric_denominator}),1)),"%"

)

)
1 Like