Power Query Problems

Create a Distribution Matrix in Excel from Source and Destination Data

Steve KSteve K Dec 2, 2026 868 views

Question details

Create a matrix that displays distribution values by source and destination.

Create a Distribution Matrix in Excel from Source and Destination Data
Product
Microsoft Excel Power Query
Device & OS
not provided
Scenario
The source table contains Source, Destination, and Distribution columns, and the user wants sources as rows and destinations as columns.
Observed behavior
The desired matrix should show the corresponding distribution value at each source and destination intersection.
Before you start

Check that the source data has headers for Source, Destination, and Distribution, and that distribution values are numeric. Decide whether repeated source-destination pairs should be summed or treated as separate records.

Solution 1Recommended

Pivot Destination in Power Query

Use Power Query to create a refreshable matrix, especially for a large or changing dataset.

1
Load the source table

Select a cell in the source data and choose Data > From Table/Range. Confirm that the table has headers.

2
Keep the matrix fields

In Power Query Editor, select the Source, Destination, and Distribution columns, then use Home > Remove Columns > Remove Other Columns.

3
Pivot destinations

Select the Destination column and choose Transform > Pivot Column. In the dialog, select Distribution as the Values Column.

4
Choose aggregation

Under Advanced options, select Sum if repeated source-destination pairs should be added. If each pair is unique, you can select Don't Aggregate instead, then click OK.

5
Load and refresh

Choose Home > Close & Load to return the matrix to Excel. After changing the source data, use Data > Refresh All to update it.

Pivot Destination in Power Query
Missing combinations: Power Query may show null for source-destination combinations with no matching record. Replace null values with zero in the editor if zero is appropriate for your data.
Create a matrix in WPS Spreadsheet

Build a Distribution Matrix with a WPS PivotTable

Use a PivotTable in WPS Spreadsheet to arrange sources as rows, destinations as columns, and distribution values in the matrix.

  1. 1. Open the data: Open your workbook in WPS Spreadsheet and select a cell in the source table.
  2. 2. Insert a PivotTable: Choose Insert > PivotTable, confirm the data range, and choose where to place the PivotTable.
  3. 3. Arrange the fields: Drag Source to Rows, Destination to Columns, and Distribution to Values in the PivotTable field list.
  4. 4. Check the calculation: Open the Distribution value field settings and select Sum if repeated source-destination values should be added. Use the PivotTable refresh command after updating the source data.
Summarize distribution values by source and destination.Open and edit Microsoft Excel XLSX and XLS files.Refresh the PivotTable when the source data changes.Use a familiar spreadsheet interface.
microsoft office alternative - wps office

Frequently Asked Questions

Which column should I pivot in Power Query?

Select Destination and choose Transform > Pivot Column. Set Distribution as the Values Column so each destination becomes a matrix column.

What happens if a source and destination appear more than once?

Choose Sum in the Pivot Column advanced options to add their distribution values. Don't Aggregate requires each source-destination pair to be unique.

How do I update the matrix after changing the source data?

In Excel, choose Data > Refresh All to reload the Power Query result. Make sure new records are included in the source table.

Why does a matrix cell show null or zero?

A null in Power Query can mean there is no matching source-destination record. A SUMIFS formula returns zero when there is no match, though zero can also be the sum of matching values.