logo
search
Pivot Table Issues

How to Use Distinct Count and Weekly Grouping in Excel Power Pivot

Huda QurayshiHuda Qurayshi Sep 25, 2026 870 views

Question details

The user needs to group data by weeks and calculate a distinct count simultaneously in a PivotTable.

How to Use Distinct Count and Weekly Grouping in Power Pivot
Product
Excel Power Pivot
Device & OS
not provided
Scenario
Analyzing dataset trends by viewing the distinct count of items on a weekly basis.
Observed behavior
Standard PivotTables support weekly grouping but lack the Distinct Count function. Power Pivot allows Distinct Count but does not automatically group dates by week.
Before you start

Ensure the Power Pivot add-in is enabled in your Excel COM Add-ins settings, and format your source data as a standard Excel Table before adding it to the Data Model.

Solution 1Recommended

Create and Relate a Calendar Table in the Data Model

By creating a dedicated calendar table with week-based fields and linking it to your main data, you can utilize Power Pivot's Distinct Count while retaining weekly groupings.

In a data model environment, time intelligence and custom grouping are best handled by a dedicated date or calendar table. This allows you to define custom time periods like weeks, fiscal quarters, or specific holidays without cluttering your original dataset.

1
Create a Calendar Table

In Excel, create a new table containing a continuous list of dates that covers the entire date range of your main data.

2
Add a Weekly Grouping Column

Add a new column to your calendar table named 'Week Start' or 'Week Number'. Use a formula like =A2-WEEKDAY(A2,2)+1 to calculate the start of the week.

3
Add Tables to Data Model

Select each table, go to the Power Pivot tab on the ribbon, and click 'Add to Data Model'.

4
Create a Relationship

Open the Power Pivot window, switch to Diagram View, and drag the date column from your main data table to the date column in your new calendar table to establish a relationship.

5
Insert the PivotTable

Insert a PivotTable from the Data Model. Drag the 'Week Start' field from the calendar table to the Rows area, and apply the Distinct Count summarization to your target field in the Values area.

Create and Relate a Calendar Table in the Data Model
Automatic Date Tables: You can also use the 'Design > Date Table > New' feature inside the Power Pivot window to automatically generate a calendar table, then use DAX calculated columns to add your weekly groupings.
Free Microsoft Office alternative

Looking for a Lightweight Alternative for Data Analysis?

While Power Pivot is a specific feature of Microsoft Office, WPS Office provides a highly compatible, free, and lightweight alternative for everyday spreadsheet tasks, including robust standard PivotTables, advanced formulas, and efficient data analysis.

  1. 1. Download and Install: Visit the official WPS Office website to download and install the free suite on your device.
  2. 2. Open Your Spreadsheet: Launch WPS Spreadsheet and easily open your existing Excel workbooks to seamlessly continue your data analysis.
  3. 3. Create PivotTables: Use the Insert tab to add standard PivotTables and manage data grouping using built-in calculation features.
Fully compatible with Microsoft Excel (.xlsx, .xls) and CSV formatsRobust built-in data analysis tools and PivotTable capabilitiesLightweight installation with fast performance for large datasetsFamiliar user interface with zero learning curve for Excel users
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the standard Excel PivotTable have Distinct Count?

Standard PivotTables in Excel use a basic cache memory that does not support the distinct count aggregation. To enable Distinct Count, you must check 'Add this data to the Data Model' when creating the PivotTable, which loads the data into the advanced xVelocity engine.

How do I group dates by weeks in a regular PivotTable without Power Pivot?

In a standard PivotTable, right-click any date in your Row labels, select 'Group', deselect 'Months' and 'Quarters', select 'Days', and set the 'Number of days' to 7. Note that this method prevents you from using Distinct Count.

Can I use DAX to calculate Distinct Count?

Yes. In Power Pivot, you can create a DAX measure using the DISTINCTCOUNT() function. For example: DistinctItems:=DISTINCTCOUNT([YourColumnName]). You can then drop this measure into your PivotTable alongside your calendar table's week field.