Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Running Total for Count Distinct Measure

I am trying to count distinct values in a by date and create a new measure that calculates the cumulative sum of the distinct counts as the time period progresses: The table on the left is representative of my data table. The table on the right is what I would like to my counts to look like.

 

pbaba_1-1598139524702.png

 

Any help you can provide is appreciated!!

 

 

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

Assuming you have a calendar table

https://exceleratorbi.com.au/power-pivot-calendar-tables/

something like this

Distinct products =DISTINCTCOUNT(data[product])

 

Running total =CALCULATE(sumx(values(calendar[date]),[Distinct Products]),Filter(All(calendar),calendar[date] <= max(calendar[date])))

 

use the calendar date column in your visual. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

4 REPLIES 4
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem solved?

 

If it is solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If not, please let me know.

 

 

Best Regards,

Icey

Anonymous
Not applicable

HI @Anonymous 

 

I used the below to get the running total.

 

CALCULATE (
    SUM ( 'Table'[Count Distinct Product] ),
    ALL ( 'Table' ),
    'Table'[Date] < EARLIER ( 'Table'[Date] )
)

 

 

MattAllington
Community Champion
Community Champion

Assuming you have a calendar table

https://exceleratorbi.com.au/power-pivot-calendar-tables/

something like this

Distinct products =DISTINCTCOUNT(data[product])

 

Running total =CALCULATE(sumx(values(calendar[date]),[Distinct Products]),Filter(All(calendar),calendar[date] <= max(calendar[date])))

 

use the calendar date column in your visual. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
Anonymous
Not applicable

Thank you! This worked.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors