Distinct count over using date parameters and also PRE_FILTER

I am trying create a calculated field which counts a distinct count of IDs. I want to use the calculated field to scale up a percentage for an estimate value. Currently, I have multiple filters on the table which would affect the value of the distinct count over so I have it set to PRE_FILTER. I also want to be able to filter by a date range using two data parameters ‘startDate’ and ‘endDate’.

I have tried to add conditionals within the calculated field to try bypass the PRE_FILTER as shown below but could not get it to work. I wanted to see if there was a workaround for this.

distinctCountOver({id}, [({date} >= ${startDate} AND {date} <= ${endDate})], PRE_FILTER)

Can you try something like this instead:

distinctCountOver(ifelse(({date} >= ${startDate} AND {date} <= ${endDate}),{id},NULL), [], PRE_FILTER)

Appreciate the help! Thanks