How to Calculate counts on condition of comparing two dates with a fixed number

In my case, I’d like to count the number of opportunities that satisfies from create date to partner involve date (PAI) to be <= 45 days. I’ve tried datediff(created_date, PAI, “DD”), but would like to compare with 45 days (fixed number). How to realize the ultimate results as screenshots?


count(ifelse(datediff(created_date, PAI, “DD”)<=45,{id},NULL))

Does that work?

And then you divide by the whole count to get your percentage

1 Like