Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Validate if value(String) is a date or not using M Language

Hi    I am tryingto cretae this on the PawerQuery editor, use M Language, to evaluate if a value, or string if we can call it a string, is either valid date value or not.  I was aiming to use a Cus...
  • artemus's avatar
    4 years ago

    Your function would look like:

    try Date.FromText([DateColumn]) <> null otherwise false

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    4 years ago

    You will need to use complete formula alongwith try to suppress the error.  Don't omit try.....

     

    =try Value.Is(Date.From([Date Field]), type date) otherwise false

    If you want to convert it to date in a custom column

    try Date.From([Date Field]) otherwise null