distinctCountOver not aggregating how i expect

I have a table that includes email data where there can be multiple lines per email (sent, opened, click etc). Users should only receive one email per day max so I am trying to set up a kpi report that will send an alert if the total emails sent yesterday exceeds the total number of unique email addresses in the data. I am trying to do this using distinctCountOver but the results are confusing.

I created a calculation to work out total email addresses in the data distinctCountOver(username,[customerCode],PRE_FILTER) and was going to compare this to the distinct count of emails filtered by yesterday. but Iget the following result (this is before I even put a filter on and I would expect these numbers to be the same

Any help is appreciated, thanks

hi @j_j_Ramsay
The reason the numbers are high is because there is a second aggregation that happens at the visualization level. In your screenshot you can see total users is aggregated as a sum. This will cause double counting. From the documentation:

For LAC-W functions, the visual aggregation defaults to MIN to eliminate duplicates. To change the aggregation, open the field’s context (right-click) menu, and then choose a different aggregation.

You can either change the aggregation in the field wells, or wrap your calculation in a min().

I hope this helps. Happy dashboarding!