Calculation Issues

Create a Cumulative Distinct Count in Excel Power Pivot

Kushani NimanthikaKushani Nimanthika Dec 2, 2026 869 views

Question details

Create a running distinct count that removes the date-column filter while preserving other filters.

Create a Cumulative Distinct Count in Excel Power Pivot
Product
Microsoft Excel Power Pivot
Device & OS
not provided
Scenario
A PivotTable needs to show the cumulative number of distinct IDs up to each date, subject to filters on other columns.
Observed behavior
The desired measure counts each ID once through the current date while retaining applicable non-date-column filters.
Before you start

Make sure the fact table and a separate Date table are in the Excel Data Model and have an active relationship between their date columns. Use the Date table's date column in the PivotTable, and identify the fact-table column whose distinct values you want to count.

Solution 1Recommended

Create a cumulative distinct count measure with DAX

Use this measure to count distinct IDs through the current date without clearing filters on other columns.

1
Open a new measure

In Excel, select Power Pivot > Measures > New Measure. Choose the table where you want to store the measure.

2
Enter the DAX formula

Name the measure Cumulative Distinct Count and enter: =VAR CurrentDate = MAX('Date'[Date]) RETURN CALCULATE(DISTINCTCOUNT(Fact[ID]), FILTER(ALL('Date'[Date]), 'Date'[Date] <= CurrentDate)). Replace the table and column names with those in your Data Model, then select OK.

3
Add the measure to the PivotTable

In the PivotTable Fields pane, add 'Date'[Date] to Rows and Cumulative Distinct Count to Values. Add other fields as filters or slicers as needed.

4
Check the results

Apply a non-date filter in the PivotTable or a slicer and confirm that the cumulative count changes accordingly. Check several dates against the source records.

Create a cumulative distinct count measure with DAX
Other date filters still apply: ALL('Date'[Date]) clears only the filter on that date column. Filters on other Date table columns, such as Year or Month, or directly on a fact-table date column can still restrict the result. DISTINCTCOUNT also counts a blank ID as a distinct value.
Free Microsoft Office alternative

Work with spreadsheet data in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface for working with spreadsheets. Its Microsoft Office format compatibility can make it easier to move everyday files between applications; it does not fix Excel Power Pivot or replace this DAX measure.

Open and edit Microsoft Excel XLSX and XLS filesReview and organize spreadsheet data used for counting and reportingUse a familiar spreadsheet interface for everyday workMove common Office files between applications with less disruption
microsoft office alternative - wps office

Frequently Asked Questions

Why does the measure use a separate Date table?

A related Date table supplies the date context for the PivotTable and lets the measure remove the filter on 'Date'[Date] before applying the cumulative date range. Check the active relationship in Power Pivot's Diagram View.

Will a Year or Month filter be removed?

No. ALL('Date'[Date]) removes the filter on the date column only. Filters on other columns, including Year and Month in the Date table, remain and can limit which dates are counted.

Does DISTINCTCOUNT include blank IDs?

Yes. DISTINCTCOUNT counts a blank as a distinct value. If blank IDs should be excluded, add an appropriate nonblank filter to the measure.

Why might the count not accumulate across all earlier dates?

Check that the PivotTable uses 'Date'[Date], that the Date table has an active relationship to the fact table, and that other Date table columns or fact-table date filters are not restricting the earlier dates.