Table.Partition

The process involves dividing the table into multiple groups of tables based on the column value and a hash function. The hash function is used to calculate a hash value for each row in the column. Th...

Syntax

Table.Partition(table as table, column as text, groups as number, hash as function) as list

About

The process involves dividing the table into multiple groups of tables based on the column value and a hash function. The hash function is used to calculate a hash value for each row in the column. This hash value is then divided by the number of groups to determine which table the row will be assigned to. Input: - Table: The original table that needs to be partitioned. - Column: The specific column used for hashing to determine the destination table. - Groups: The total number of tables the input table will be split into. - Hash Function: The function applied to generate the hash value.

Explanation

Divide the given table ({[a = 2, b = 4], [a = 6, b = 8], [a = 2, b = 4], [a = 1, b = 4]}) into two separate tables based on the values in column [a], using the column values as the hash function. Use the Power Query MTable.Partition function with the following parameters: - Source table: Table.FromRecords({[a = 2, b = 4], [a = 1, b = 4], [a = 2, b = 4], [a = 1, b = 4]}) - Column for partitioning: "a" - Number of partitions: 2 - Function to apply: each _ The output will be: Table 1: {[a = 2, b = 4], [a = 2, b = 4]} Table 2: {[a = 1, b = 4], [a = 1, b = 4]}