Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have 3 date columns and like to add max date per each row.
How do I achieve this in power query or can i created as a column not measure?
Thank you!
Solved! Go to Solution.
Hi @topazz11
If you have a finite number of date columns, you could try adding a custom column something like this.
if [date1] > [date2] then
if [date1] > [date3] then [date1] else [date3]
else
if [date2] > [date3] then [date2] else [date3]
If you aren't sure how many dates in a record, that makes things tougher.
Let me know if this helps.
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"id", Int64.Type}, {"date1", type datetime}, {"date2", type datetime}, {"date3", type datetime}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Max(List.Skip(Record.ToList(_),1)))
in
#"Added Custom"
Hope this helps.
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"id", Int64.Type}, {"date1", type datetime}, {"date2", type datetime}, {"date3", type datetime}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.Max(List.Skip(Record.ToList(_),1)))
in
#"Added Custom"
Hope this helps.
Thank you.
Hi @topazz11
If you have a finite number of date columns, you could try adding a custom column something like this.
if [date1] > [date2] then
if [date1] > [date3] then [date1] else [date3]
else
if [date2] > [date3] then [date2] else [date3]
If you aren't sure how many dates in a record, that makes things tougher.
Let me know if this helps.
User | Count |
---|---|
75 | |
75 | |
45 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |