Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Dicken
Post Prodigy
Post Prodigy

List.Remove (Matching) Items

 

 

Can someone clarify if there is any dfference between these to for examaple 

= let alist = {"a","b","b","c","d","e"} , rlist = {"b","d","c"} 
in 
List.RemoveMatchingItems( alist , rlist )

= let alist = {"a","b","b","c","d","e"} , rlist = {"b","d","c"} 
in 
List.RemoveItems( alist , rlist )

so looking at docs, it seems to suggest that with Matching only 1 "b"  would be removed, but this does not seem to be the case, 
 can anyone help with how these to differ , if they do? 

 

2 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

The difference is that List.RemoveMatchingItems  supports an optional equationCriteria function where you can define what "matching" means.

View solution in original post

Chewdata
Responsive Resident
Responsive Resident

Hey!

Like @lbendlin  says with List.RemoveMatchingItems you have a little more control on how he sees matches. For example, if you have a list that randomly has some Uppercase and lowercase words, you can use a comparison criteria to make power query ignore Uppercases. See the code below:

let
    // our list of names
    Source = {
        "Luke", "Leia",
        "C3PO", "R2D2",
        "Darth Vader", "Anakin Skywalker",
        "Leia", "Chewbacca"
    },

    // the list with characters we want to remove
    RemoveList = {
        "r2d2", 
        "LEia"
        },


    // with Comparer.OrdinalIgnoreCase we can ignore all the uppercase letters so he matches correctly
    Result = List.RemoveMatchingItems(
        Source, 
        RemoveList, 
        Comparer.OrdinalIgnoreCase
        )
in
    Result

 

Hopefully this explains it!

View solution in original post

3 REPLIES 3
Chewdata
Responsive Resident
Responsive Resident

Hey!

Like @lbendlin  says with List.RemoveMatchingItems you have a little more control on how he sees matches. For example, if you have a list that randomly has some Uppercase and lowercase words, you can use a comparison criteria to make power query ignore Uppercases. See the code below:

let
    // our list of names
    Source = {
        "Luke", "Leia",
        "C3PO", "R2D2",
        "Darth Vader", "Anakin Skywalker",
        "Leia", "Chewbacca"
    },

    // the list with characters we want to remove
    RemoveList = {
        "r2d2", 
        "LEia"
        },


    // with Comparer.OrdinalIgnoreCase we can ignore all the uppercase letters so he matches correctly
    Result = List.RemoveMatchingItems(
        Source, 
        RemoveList, 
        Comparer.OrdinalIgnoreCase
        )
in
    Result

 

Hopefully this explains it!

lbendlin
Super User
Super User

The difference is that List.RemoveMatchingItems  supports an optional equationCriteria function where you can define what "matching" means.

Thank you both , 

Richard.

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.