Forum Discussion

seankeatingpb's avatar
seankeatingpb
Regular Visitor
2 months ago
Solved

Filter a column with duplicate values based on the highest Index value

Hello.

 

I am struggling to find a solution for something that I believe should be quite simple. I have a column of values (some of which are duplicates) that I want to filter to show only those with the highest Index number (example below).

 

 

Current Data::

 

Case Ref:        Index No.

 

545059           0

545059           1 

545060           2

545060           3

545060           4

545061           5

545061           6

545061           7

545062           8

545062           9

545063          10

 

 

Result i'm trying to achieve:

 

Case Ref:        Index No.

545059              1

545060              4

545061              7

545062              9

545063             10

 

 

 

Thanks in advance.

  • Hi

    Group by Ref and choose Max Index

     

    = Table.Group(YourSource, {"Case Ref:"}, {{"Index No.", each List.Max([#"Index No."]), type number}})

    or

    = Table.Sort(
    Table.Distinct(
    Table.Buffer(
    Table.Sort(
    YourSource,
    {{"Index No.", Order.Descending}})),
    {"Case Ref:"}),
    {{"Index No.", Order.Ascending}})

     

    Stéphane

2 Replies

  • Hi

    Group by Ref and choose Max Index

     

    = Table.Group(YourSource, {"Case Ref:"}, {{"Index No.", each List.Max([#"Index No."]), type number}})

    or

    = Table.Sort(
    Table.Distinct(
    Table.Buffer(
    Table.Sort(
    YourSource,
    {{"Index No.", Order.Descending}})),
    {"Case Ref:"}),
    {{"Index No.", Order.Ascending}})

     

    Stéphane

    • seankeatingpb's avatar
      seankeatingpb
      Regular Visitor

      Thank you, I knew it would be there staring at me right in the face 🙂