Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Check for earliest date in table for comparison using M results in cyclic error

In Power Query, I have a table which has a date column. I want to write a custom column that checks if the date is the minimum date for that field, then return true, else false.   if List.Contains(...
  • v-yulgu-msft's avatar
    8 years ago

    Hi Anonymous,

     

    To get the minimum date in a column, please refer to this syntax:

    AddCustom = Table.AddColumn(PreviousStep, "Custom", each List.Max(PreviousStep[a]))

     

    Then, wrap above step inside an if condition.

    = Table.AddColumn(#"Changed Type", "Custom.1", each if [Date]=List.Min(#"Changed Type"[Date]) then "true" else "false")

     

    Best regards,

    Yuliana Gu