Power Query Problems

Calculate Nested Table Values Without Expanding in Excel Power Query

Tauseeq MagsiTauseeq Magsi Nov 18, 2026 869 views

Question details

Calculate a value from each nested table created by a merge without expanding the nested rows.

Calculate Nested Table Values Without Expanding in Excel Power Query
Product
Microsoft Excel Power Query
Device & OS
not provided
Scenario
A merged query contains a column of nested tables, and the user wants a sum or row count for each main-query row.
Observed behavior
Each nested table can be summarized in a custom column while keeping the main query at its existing row level.
Before you start

Open the merged query in Power Query Editor and identify the nested-table column and the field you want to calculate. Confirm that the field contains numeric values if you plan to sum it.

Solution 1Recommended

Add a Custom Column to Summarize Each Nested Table

Use an M expression to calculate a sum or row count without expanding the merged results.

1
Open the merged query

In Excel, open Data > Queries & Connections, then double-click the merged query to open Power Query Editor.

2
Create a custom column

Select Add Column > Custom Column and enter a name such as Total.

3
Enter the calculation

In the custom column formula box, enter List.Sum([MergedTable][Amount]). Replace MergedTable with the nested-table column name and Amount with the numeric field name, then select OK.

4
Set the result type

Select the new Total column and choose an appropriate numeric type from Transform > Data Type.

5
Remove the nested column if needed

If you no longer need the nested tables, right-click the MergedTable column header and select Remove. Select Home > Close & Load when finished.

Add a Custom Column to Summarize Each Nested Table
Count rows instead: To count the rows in each nested table, use Table.RowCount([MergedTable]) in the Custom Column formula box and replace MergedTable with your column name.
Free Microsoft Office alternative

Work with Spreadsheet Results in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open compatible Excel files and continue working with their spreadsheet data; use Excel Power Query for the nested-table calculation and query refresh.

Review and analyze calculated spreadsheet results in WPS SpreadsheetsOpen and save Microsoft Excel XLSX filesUse a familiar interface to make the transition from Office easierWork with a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

How do I count matching rows without expanding the merged column?

In Power Query Editor, select Add Column > Custom Column and enter Table.RowCount([MergedTable]), replacing MergedTable with your nested-table column name.

Why does my sum formula return an error?

Check that the names in List.Sum([MergedTable][Amount]) match the nested-table column and its field, and that the field contains numeric values. Inspect the error in Power Query Editor for more detail.

Can I remove the nested-table column after calculating the total?

Yes. After adding the custom column, right-click the nested-table column header and select Remove. The calculation remains based on the earlier query step.

Will this calculation add rows to my main query?

No. The custom column returns one summary value for each existing main-query row, rather than expanding each nested table into multiple rows.