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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
fabdata1207
Regular Visitor

Simple Running Count

Hi all

 

I need to do a simple running total with sort by date

 

in the below sample I need to create a measure as the same of Running Total and that counts the CODE and sort based on Date exactly like the Running Total column

 

CODEDateRunning Total
B1/07/20211
A4/07/20212
A7/07/20212
D9/07/20213
C9/07/20214
F15/07/20215
F20/07/20216
F20/07/20216
E20/07/20216
Total31/07/20216

 

 

is that possible ?

 

Thanks all

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@fabdata1207 

you can try this

 

Measure = 
VAR _total=CALCULATE(DISTINCTCOUNT('Table'[CODE]),FILTER(all('Table'),'Table'[Date]<=max('Table'[Date])))
return if (ISFILTERED('Table'[CODE]),_total, DISTINCTCOUNT('Table'[CODE]))

 

1.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

There are duplicate combinations of CODE and Date i.e. F and 20/7/2021.  Is this by design?  I ask because when these 2 columns will be dragged to the visual, you will see only 1 row for F and 20/7/2021.  Is there any other column you have in your dataset which makes the CODE and Date combination unique?  If not, then would you want a calculated column solution instead of a measure?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ryan_mayu
Super User
Super User

@fabdata1207 

you can try this

 

Measure = 
VAR _total=CALCULATE(DISTINCTCOUNT('Table'[CODE]),FILTER(all('Table'),'Table'[Date]<=max('Table'[Date])))
return if (ISFILTERED('Table'[CODE]),_total, DISTINCTCOUNT('Table'[CODE]))

 

1.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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