Table.PositionOfAny
This function retrieves the position(s) of the first instance of the specified rows in the table. It returns -1 if the rows are not found in the table. Parameters include: - table: the input table - r...
Table.PositionOfAny(table as table, rows as list, optional occurrence as nullable number, optional equationCriteria as any) as any
This function retrieves the position(s) of the first instance of the specified rows in the table. It returns -1 if the rows are not found in the table. Parameters include:
- table: the input table
- rows: the list of rows to search for in the table
- occurrence: (optional) indicates which instance of the row to return
- equationCriteria: (optional) determines how the table rows are compared.
Determine the index of the first occurrence of either [a = 2, b = 4] or [a = 6, b = 8] in the table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}).
Power Query MTable.PositionOfAny(
Table.FromRecords({
[a = 2, b = 4],
[a = 1, b = 4],
[a = 2, b = 4],
[a = 1, b = 4]
}),
{
[a = 2, b = 4],
[a = 6, b = 8]
}
)
Output: 0
Find the positions of all occurrences of [a = 2, b = 4] or [a = 6, b = 8] in the table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}.
Power Query MTable.PositionOfAny(
Table.FromRecords({
[a = 2, b = 4],
[a = 6, b = 8],
[a = 2, b = 4],
[a = 1, b = 4]
}),
{
[a = 2, b = 4],
[a = 6, b = 8]
},
Occurrence.All
)
Output: {0, 1, 2}