Forum Discussion

phchu1226's avatar
phchu1226
Helper IV
4 years ago
Solved

Error on MIN function while creating custom column

Hi all, I want to write a formula to extract the min. date from the column. However, the "MIN" function seems do not work..? Do anyone know how to achieve this? Thank you.  
  • VahidDM's avatar
    VahidDM
    4 years ago

    Hi phchu1226 

     

    I checked your file, use this code:

    = Table.AddColumn(SOP_PROD_OS1, "Custom", each if [S_DATE]=List.Min(SOP_PROD_OS1[#"S_DATE"]) then "Week0" else "Week1")

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

    Appreciate your Kudos🙏!!

  • VahidDM's avatar
    VahidDM
    4 years ago

    The last step in your file is "SOP_PROD_OS1", you can find it if you open the advance editor.
    It shows Navigation because your file is connected to Oracle DB.

     

    You can find the Last Date in your list, then find the seven days before the date, and write an if statement to put yes if the date is => than that date.

    At the end, filter on Yes on the new column.

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

    Appreciate your Kudos ✌️!!