Hi @martynross85,
Alternatively you could handle this in PQ
Paste this M code into a new blank query.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdBLDsUgCAXQvThuwgVFcC1N97+N2k9aX5/REYQTQrjrGlhi0rDUqgBqAyYWEgjCtnQ8VsfIQSgT94nbwKUQ8sR15E5I/+4NxwFnQiedlrnhpG51bEnLzWe2XH44qz/MHTbV44jYlfyHj9O4+Az+uy3vY37ztgM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Job Number" = _t, EstValue = _t, Date = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Job Number", Int64.Type}, {"EstValue", Int64.Type}, {"Date", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Job Number"},
{{"AllRows", each
let
AscendingSort = Table.Sort(_,{{"Date", Order.Ascending}}),
Buffer = Table.Buffer(AscendingSort),
AddIndex = Table.AddIndexColumn(Buffer, "Index", 1, 1, Int64.Type),
MaxEst = Table.AddColumn(AddIndex, "Min Est Val", each AddIndex[EstValue]{0}?),
MinEst = Table.AddColumn(MaxEst, "Max Est Val", each List.Reverse(AddIndex[EstValue]){0}?)
in
MinEst, type table [Job Number=nullable number, EstValue=nullable number, Date=nullable date, Index = number, Min Est Val = nullable number, Max Est Val = nullable number]},
{"MaxVal", each Table.RowCount(_), Int64.Type}, {"MinVal", each 1, Int64.Type}}),
#"Expanded AllRows" = Table.ExpandTableColumn(#"Grouped Rows", "AllRows", {"EstValue", "Date", "Index", "Min Est Val", "Max Est Val"}, {"EstValue", "Date", "Running Count", "Min Est Val", "Max Est Val"})
in
#"Expanded AllRows"
Note that the Running Count, MinVal and MaxVal columns are not required to determine the āMin Est Valā and āMax Est Valā
I hope this is helpful