Forum Discussion

Hdema's avatar
Hdema
New Member
3 years ago
Solved

Values with the highest mark

Hi

I have a table like this:

 

Ref. No.EvaluationValue
A52
A43
A73
B62
B53
B33
B42

 

My goal is to group this data based on its maximum valuation through power query and get the following table:

 

Ref. No.Max EvaluationValue
A73
B62

 

I tried to group it by this:

 

= Table.Group(#"Previous step", {"Ref. No."}, {{"Max Evaluation", each List.Max([Evaluation]), type nullable number}})

 

But I get the Max Evaluation without its corresponding value

 

I would be gratefull for your help

 

Best regards

  • Hi

    let
    Source = YourSource,
    Sort = Table.Sort(Source,{{"Evaluation", Order.Descending}}),
    Distinct = Table.Distinct(Sort, {"Ref. No."})
    in
    Distinct

    Stéphane

     

3 Replies

  • Hi

    let
    Source = YourSource,
    Sort = Table.Sort(Source,{{"Evaluation", Order.Descending}}),
    Distinct = Table.Distinct(Sort, {"Ref. No."})
    in
    Distinct

    Stéphane

     

  • Or with Table.Group

    = Table.Group(
    Source,
    {"Ref. No."},
    {{"Max", each List.Max([Evaluation]), type nullable number},
    {"Value", each [Value]{List.PositionOf([Evaluation],List.Max([Evaluation]))}, type nullable number}}
    )

    Stéphane

  • Thank you very much Stéphane, it worked perfectly good!!!