List.PositionOfAny

 

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.

Finds the first occurrence of any value in values and returns its position.

List.PositionOfAny(list as list, values as list, optional occurrence as nullable number, optional equationCriteria as any) as any  

ArgumentDescription
listThe List to check.
valuesThe list of values to check for.
optional occurrenceAn enum that controls the scope of operation.
optional equationCriteriaAn optional equation criteria value to control equality comparisons. For more information about equality comparisons, see Parameter Values .
SettingDescription
Occurrence.First and Occurrence.LastReturns a single position.
Occurrence.AllReturns a list of positions with all occurrences.
  • If the value is not found in the list, -1 is returned
List.PositionOfAny({"A", "B", "C", "D"}, {"B", "C"}) equals 1  

List.PositionOfAny({"A", "B", "C", "B", "A"}, {"A", "B"}, Occurrence.First) equals 0

List.PositionOfAny({"A", "B", "C", "B", "A"}, {"A", "B"}, Occurrence.Last) equals 4  

List.PositionOfAny({"A", "B", "C", "B", "A"}, {"A", "B"}, Occurrence.All) equals {0, 1, 3, 4}  

Show: