Forum Discussion
Returning latest among multiple dates by row?
- 4 years ago
Hi tfoss78 ,
There two Table.AddColumn in you code.
I get the correct result by add a custom column.
List.Max({[Column1],[Column2],[Column3]})Here's the whole code below, you can copy-paste in a blank query to see the step.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtI31zc0UtKBsxFMM6VYHbgaY4S4EZJyC2Q1SOKmCKalUmwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}, {"Column2", type date}, {"Column3", type date}}), #"Added Custom1" = Table.AddColumn(#"Changed Type", "Max", each List.Max({[Column1],[Column2],[Column3]})) in #"Added Custom1"I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can use MAX, you just need to put the columns into a table variable, like
Max of columns = MAXX( { 'Table'[Col1], 'Table'[Col2], 'Table'[Col3] }, [Value])- tfoss784 years agoRegular Visitor
Hi John, thanks very much for this bit of insight. However, I'm encountering a problem with the value part of the expression - I don't need any calculation per se, just that it return the latest among seven dates specified in the first part of the expression. Is this possible using MAXX? Sorry if I'm being dim here.
- johnt754 years ago
Super User
The table constructor { } creates a table with a single column called [Value]. By adding all the dates you want to compare into a table like that you can run MAXX over it.