Forum Discussion

Andy1927's avatar
Andy1927
Helper I
5 years ago
Solved

Simple Conditional Column on Today's Date - Power Query

Hi, I want to add a column using Power Query that shows anything before Todays date = "expired" else "live"   I have this code but im getting an error saying 'Expression.SyntaxError: Token Then ex...
  • amitchandak's avatar
    5 years ago

    Andy1927 , there is addition comma , removed here 

    if [Agreement End Date] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Live"

     

    or

     

    = Table.AddColumn(#"Added Conditional Column", "Historic", each if [Agreement End Date] <= DateTime.Date(DateTime.LocalNow()) then "Expired" else "Live")