Table.PositionOf

This function retrieves the position of the first instance of the specified row in the input table. If the row is not found, it returns -1. Parameters: - table: The table in which to search for the ...

Syntax

Table.PositionOf(table as table, row as record, optional occurrence as any, optional equationCriteria as any) as any

About

This function retrieves the position of the first instance of the specified row in the input table. If the row is not found, it returns -1. Parameters: - table: The table in which to search for the row. - row: The row to locate in the table. - occurrence: Specifies which instance of the row to retrieve (optional). - equationCriteria: Controls how the rows in the table are compared (optional).

Explanation

Determine the location of the first instance of [a = 2, b = 4] in the table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}). Using the Power Query M function Table.PositionOf: Table.PositionOf( Table.FromRecords({ [a = 2, b = 4], [a = 1, b = 4], [a = 2, b = 4], [a = 1, b = 4] }), [a = 2, b = 4] ) Output: 0 Determine the location of the second instance of [a = 2, b = 4] in the table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}). Using the Power Query M function Table.PositionOf: Table.PositionOf( Table.FromRecords({ [a = 2, b = 4], [a = 1, b = 4], [a = 2, b = 4], [a = 1, b = 4] }), [a = 2, b = 4], 1 ) Output: 2 Determine the location of all instances of [a = 2, b = 4] in the table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}). Using the Power Query M function Table.PositionOf: Table.PositionOf( Table.FromRecords({ [a = 2, b = 4], [a = 1,