Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
jk100
Frequent Visitor

Add custom date column containing the current date

Hi,

I'm trying to create a custom column that adds the current date. The current date is the Date column with the highest number.
In my example for Project1 the current date can be found in column [Date3] = 03.01.2023.
However, for Project2 the current date can be found in column [Date2] = 03.02.2023.

currentDate01.png
With added current date column, but wrong value for Project2:
currentDate02.png

Does anyone know a solution on how to deal with this issue?

My sample code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCijKz0pNLjFU0lEyMNQHIiMDIyMQx0jfwATEMQZxjKEyII6xUqwOXB9MqSGyUiMYB4iMlGJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, Date1 = _t, Date2 = _t, Date3 = _t, #"Number of Dates" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Project", type text}, {"Date1", type date}, {"Date2", type date}, {"Date3", type date}, {"Number of Dates", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Current Date", each [Date3])
in
    #"Added Custom"

 

1 ACCEPTED SOLUTION
artemus
Microsoft Employee
Microsoft Employee

Oh, I misunderstood you. Then the custom column would look like:

[Date3] ?? [Date2] ?? [Date1]

View solution in original post

4 REPLIES 4
artemus
Microsoft Employee
Microsoft Employee

Oh, I misunderstood you. Then the custom column would look like:

[Date3] ?? [Date2] ?? [Date1]
artemus
Microsoft Employee
Microsoft Employee

Your custom column would look like:

List.Max({[Date1], [Date2], [Date3]})
jk100
Frequent Visitor

Thank you for your reply!

Unfortunately for Project1 the column [Date3] has an earlier date than [Date2] and it should pick the date in the column with the highest number, so List.Max() does not work here.

Anonymous
Not applicable

I guess the List.Max should work.
Can you please check the date format of all the date column used here. Is it dd/mm/yyyy or mm/dd/yyyy?


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.