Pivot Table Issues

Create an Excel PivotTable with People in Both Rows and Columns

Algirdas JasaitisAlgirdas Jasaitis Nov 27, 2026 869 views

Question details

Create a PivotTable that lists people on both axes and counts the distinct routes each pair traveled together.

Create an Excel PivotTable with People in Both Rows and Columns
Product
Microsoft Excel PivotTables and Power Pivot
Device & OS
not provided
Scenario
The source data contains a person and a route ID for each traveler-route record.
Observed behavior
A simple count using the same person field on both axes does not provide the required pairwise count of shared route IDs.
Before you start

Check that each source row identifies one person and one route ID, and remove blank person or route ID values. Use a version of Excel with Power Pivot, the Data Model, and the DAX TREATAS function available.

Solution 1Recommended

Use disconnected person lists and a Power Pivot measure

Create separate row and column lists, then calculate the intersection of each person’s distinct route IDs.

The two person lists must remain disconnected from the travel data. The measure applies each selected person to the travel table separately, then counts the route IDs common to both sets.

This example assumes the source table is named travel_data and its columns are named Person and Route ID. Replace these names in the formula if your workbook uses different names.

1
Add the travel data to the model

Select the source range, choose Insert > Table, and name it travel_data on the Table Design tab. Select Power Pivot > Add to Data Model.

2
Create two person lists

Copy the Person column to two separate worksheet ranges. Use Data > Remove Duplicates on each copy, format each list with Insert > Table, and name the tables PeopleRows and PeopleColumns. Keep the column name Person in both tables.

3
Add the lists without relationships

Select each person table and choose Power Pivot > Add to Data Model. In Power Pivot > Manage, check Diagram View and leave PeopleRows and PeopleColumns without relationships to travel_data.

4
Create the shared-route measure

Choose Power Pivot > Measures > New Measure, select travel_data, and name the measure Shared Routes. Enter: =VAR RowRoutes = CALCULATETABLE(VALUES(travel_data[Route ID]), REMOVEFILTERS(travel_data[Person]), TREATAS(VALUES(PeopleRows[Person]), travel_data[Person])) VAR ColumnRoutes = CALCULATETABLE(VALUES(travel_data[Route ID]), REMOVEFILTERS(travel_data[Person]), TREATAS(VALUES(PeopleColumns[Person]), travel_data[Person])) RETURN COUNTROWS(INTERSECT(RowRoutes, ColumnRoutes))

5
Build the PivotTable

Choose Insert > PivotTable and select the workbook’s Data Model as the source. In PivotTable Fields, drag PeopleRows[Person] to Rows, PeopleColumns[Person] to Columns, and Shared Routes to Values.

6
Check the results

Compare a pair’s PivotTable value with the distinct route IDs for those two people in travel_data. The diagonal shows each person’s own distinct route count; values across the diagonal should match.

Use disconnected person lists and a Power Pivot measure
Keep the person lists current: If new people are added to travel_data, update both person lists and use Data > Refresh All before checking the PivotTable.
Free Microsoft Office alternative

Work with spreadsheet data in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Microsoft Office format support, making it easy to move everyday files between suites. It does not fix Excel’s Power Pivot or Data Model behavior.

Use spreadsheet tools to review traveler and route data.Open and save common Excel formats, including XLSX.Navigate a familiar interface for everyday spreadsheet work.Use a free, lightweight office suite for routine files.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I need two separate person lists?

PeopleRows and PeopleColumns provide independent selections for the two PivotTable axes. The measure uses those selections to find each person’s routes separately before comparing them.

Does the measure count duplicate route records more than once?

No. VALUES returns distinct route IDs for each selected person, and INTERSECT identifies the IDs shared by both sets.

What do the diagonal values in the PivotTable mean?

When the row and column show the same person, Shared Routes counts that person’s own distinct route IDs.

How do I include newly added travelers?

Add the new names to both PeopleRows and PeopleColumns, ensure each list contains unique names, and choose Data > Refresh All.

Can I use the same Power Pivot model and macros in WPS Office?

Do not assume full compatibility with Excel Data Models, DAX measures, or VBA macros. Test your workbook in WPS Office before relying on those features; the Power Pivot solution itself is for Excel.