Calculated field empty when referencing multiple calculated fields

Hi,

I am trying to make a calculated field to work out the recoup time (in months) for enabling a cost-saving feature, based on the one-time upfront cost of setting it up, e.g. if it cost $1000 to set it up but it saves $200 a month, it would take 5 months to recoup the setup fee. However when I try to add this into a table in my dashboard, it just returns empty values.

My code is the following, for monthy savings:
{Current Cost (Monthly)}-{New Cost (Monthly)}

For Recoup Time (Months), which is currently returning empty
{Setup Cost (One-Time)}/{Monthly Savings}

Some of the values for the Monthly Savings/Setup cost are 0, and I’ve tried to exclude them using an ifelse function to avoid dividing by 0, but the error persists. Any help resolving this would be appreciated, thanks!

Hi @Rob99

I think Quick Sight handles the Zero Divide error. For example see the following.

Have you tried ?

sum({Setup Cost (One-Time)})/sum({Monthly Savings})

Thank you, that worked

Thanks @Rob99. Can you mark this as a Solution?