Distinct Values of a date cannot be used as numeric group by in downstream queries

When counting distinct value of a datetime it produces an integer. That value when used in a downstream group by is wrongly interpreted (and casted) as a datetime.

I would expect that i would be correctly interpreted as an integer. Anything I'm missing here ?

Hi @gchev
You're seeing these issues - upvote by clicking :+1: on the first post:
https://github.com/metabase/metabase/issues/13098
https://github.com/metabase/metabase/issues/19684