Pivot Table Issues

Compare Two Dynamic Segmentation Groups in Excel Power Pivot

John WilsonJohn Wilson Nov 18, 2026 870 views

Question details

Create two independently selectable groups from one data source and compare their results dynamically.

Compare Two Dynamic Segmentation Groups in Excel Power Pivot
Product
Microsoft Excel Power Pivot
Device & OS
not provided
Scenario
A user wants to compare segments or periods using a data model, PivotTables, and slicers.
Observed behavior
Two selected groups appear side by side and update when their selections change.
Before you start

Check that your Excel version supports Power Pivot and the TREATAS DAX function. Identify the numeric value to compare and the field that defines each group; the example below uses Amount and Segment.

Solution 1Recommended

Compare segments with disconnected selectors and Power Pivot measures

Use two independent slicers to compare sums for different selections from the same segment field.

This example assumes a source table named Sales with Segment and Amount columns. The GroupA and GroupB selector tables must remain unrelated to Sales so that one slicer does not filter the other group.

The measures apply each selector's values to Sales using TREATAS. If a slicer has no filter, its measure includes all segment values in that selector table.

1
Add the source data

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

2
Create two selector tables

Copy the Sales Segment column to two separate worksheet ranges. Use Data > Remove Duplicates on each range, then choose Insert > Table and name the tables GroupA and GroupB. Add each table to the Data Model using Power Pivot > Add to Data Model.

3
Check relationships

Open Power Pivot > Manage, then use Diagram View or Manage Relationships to verify that GroupA and GroupB have no relationships to Sales. Remove any automatically created relationships involving the selector tables.

4
Create comparison measures

In Excel, choose Power Pivot > Measures > New Measure and create these measures in the Sales table: Group A Amount := CALCULATE(SUM(Sales[Amount]), TREATAS(VALUES(GroupA[Segment]), Sales[Segment])) and Group B Amount := CALCULATE(SUM(Sales[Amount]), TREATAS(VALUES(GroupB[Segment]), Sales[Segment])). Replace the table and column names if yours differ.

5
Build the comparison

Choose Insert > PivotTable and select the workbook's Data Model. Add Group A Amount and Group B Amount to Values, then use PivotTable Analyze > Insert Slicer to add slicers for GroupA[Segment] and GroupB[Segment]. Select a group in each slicer and add a shared category field to Rows if needed.

Compare segments with disconnected selectors and Power Pivot measures
Adapting the model: For independent period comparisons, use disconnected period selectors and apply them to an appropriate date or period field instead. A shared date slicer filters both measures; price, volume, and mix comparisons require measures tailored to those definitions.
Free Microsoft Office alternative

Explore spreadsheet comparisons in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and support for Excel files, making it easy to move everyday spreadsheet work between applications. Use WPS Spreadsheets for standard PivotTable analysis; the Excel Power Pivot model and DAX workflow described above require Excel.

Create PivotTables for standard spreadsheet comparisons.Open and edit Microsoft Excel XLSX and XLS files.Work in a familiar spreadsheet interface.Use a free, lightweight Office alternative.
microsoft office alternative - wps office

Frequently Asked Questions

Why do I need two disconnected selector tables?

Separate GroupA and GroupB tables let each slicer control its own measure. Leave them unrelated to Sales, then use TREATAS in each measure to apply the selected values.

Can I select more than one segment for a group?

Yes. Use the slicer's Multi-Select button or hold Ctrl while selecting items. VALUES passes the selected segments to the corresponding measure.

Why do both measures show the same total?

Check the two slicer selections. If neither slicer is filtered, both measures include all values in their selector tables. Also check that each measure references its own selector table.

How can I compare two periods instead of two segments?

Create two disconnected tables containing the periods to select, add a slicer for each, and adapt the TREATAS measures to apply each selection to the model's date or period field. The exact formula depends on how periods are represented in the data.

Can I show the comparison in a chart?

Yes. Select the completed PivotTable and choose PivotTable Analyze > PivotChart. The chart will reflect changes to the slicers connected to that PivotTable.