Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Create a column with fixed values based on current month

Hello, I am pretty new to power query and I am trying to add a column that is filled as "01/MM/YYYY" for every row. Based on a check of the current date. I.e today is 20/01/2021 so the column would b...
  • artemus's avatar
    5 years ago

    You can use the the below function. Replace Date with DateTime or DateTimeZone depending on the column type.

    Date.ToText([DateColumn], "01/MM/yyyy")
  • AlB's avatar
    5 years ago

    Hi Anonymous 

    For the first colum:

     = Date.StartOfYear(Date.From(DateTime.LocalNow()))

     For the second:

    Date.AddYears([Column1], -1)

    Note it references Column1, the first column we've created

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers