pbPassingBI
/

How to check if a data is a of type date?

beginner
Answer

`ISDATE([field])` returns true when a string can be interpreted as a date, and false otherwise.

It takes a string argument, so it is used for validating imported data rather than checking a field that is already typed as a date.

The typical pattern is a data-quality flag on a text column that should hold dates:

`IF ISDATE([Raw Date]) THEN DATE([Raw Date]) ELSE NULL END`

That converts the good rows and nulls the rest, so a handful of malformed entries do not break the whole field. Worth pairing with `ISNULL()` to count how many failed, which is usually the more interesting number.

Related questions