Forum Discussion
A function on a list
I need a function to find the highest value in one column of a 3 column list. How do I do this?
let
Source = (#"My3ColList" as any) => let
LatestDate = List.Max([Source].[Period]), type date}})
in
Source
in Source
let
Source = (Table as table) => Table.Column(Table, "Period" as text) as list,
pSource = (list as any) => List.Max(list),
x = pSource(Actuals)
in
xHi Netrelemo ,
Try the following function:
let Source = (EnterTable as any, EnterColumn as any) => List.Max(Table.Column(EnterTable, EnterColumn as text)) in SourceThen invoking function MaxValue:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQFQiUdJUMDAyDpqBSrAxU2BQubgkSdEaJmUMVAwkkpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Period = _t, Value = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Period", type date}, {"Value", Int64.Type}, {"Column2", type text}}), #"Max Value" = MaxValue(#"Changed Type","Period") in #"Max Value"If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- lbendlinSuper User
Please provide sample data in usable format (not as a picture) and show the expected outcome.
- v-kkf-msftCommunity Support
Hi Netrelemo ,
Try the following function:
let Source = (EnterTable as any, EnterColumn as any) => List.Max(Table.Column(EnterTable, EnterColumn as text)) in SourceThen invoking function MaxValue:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtQFQiUdJUMDAyDpqBSrAxU2BQubgkSdEaJmUMVAwkkpNhYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Period = _t, Value = _t, Column2 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Period", type date}, {"Value", Int64.Type}, {"Column2", type text}}), #"Max Value" = MaxValue(#"Changed Type","Period") in #"Max Value"If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.