List.ReplaceMatchingItems

 

This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.

Replaces occurrences of existing values in the list with new values using the provided equationCriteria. Old and new values are provided by the replacements parameters. An optional equation criteria value can be specified to control equality comparisons. For details of replacement operations and equation criteria, see Parameter Values.

List.ReplaceMatchingItems(list as list, replacements as any ,optional equationCriteria as any) as list  

ArgumentDescription
listThe List to modify.
replacementsThe replacements to make.
optional equationCriteriaAn optional equation criteria value to control equality testing.
List.ReplaceMatchingItems ({1, 2, 3, 4, 5}, {{2, -2}}) equals { 1, -2, 3, 4, 5}  

List.ReplaceMatchingItems ({1, 2, 3, 4, 5}, {{2, -2}, {3, -3}}) equals { 1, -2, -3, 4, 5}  

Show: