Matrix Multiplication in Power Query M. Test example = MatrixMultiplication(#table({"A","B"},{{1,2},{3,4}}), #table({"A","B"},{{1,2},{3,4}}))
✓ Published0🌍 Public
HHugoberry
Last edited Feb 26, 2017
Created on Feb 2, 2017
This example demonstrates how to perform square matrix multiplication entirely within Power Query M, using two 2x2 tables with the values {1,2} and {3,4} as both inputs. It shows a custom function that multiplies two matrices and returns the resulting table. The implementation relies on core M language features, including `Table.ToRows`, `Table.ToColumns`, `List.Accumulate`, and `List.Zip`, to compute dot products for each row-column pair. The `dotProduct` helper iterates over zipped row and column vectors, accumulating the sum of element-wise products. The output is constructed via `Table.FromRows`, preserving the visual table format native to Power Query.
AI-generated description