Average per day calculation help

I’m having trouble with what I think should be a simple calculation. I have a table that aggregates rows by month.

I’m trying to create a calculated field that shows me the average completed appointments per day in the month.

So here is what I have for completed appointments by itself which is working correctly.

      ifelse(Status = 'Completed', 1, 0)

Here is what I have for the number of work days in the month which is working correctly by itself.

      max(netWorkDays(truncDate('MM', Date), Date))

Here is what it looks like in my table
image

So now I want to simply divide these results to get average completed per work day. I’m trying to do this but I get an error.

      ifelse(Status = 'Completed', 1, 0) / max(netWorkDays(truncDate('MM', Date), Date))

The error is just a generic “We encountered an error while generating your calculated field…”

Hi @CoreyLeichty,

Can you try this instead?

sum(ifelse(Status = 'Completed', 1, 0)) / max(netWorkDays(truncDate('MM', Date), Date))