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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Incremental Count of duplicated data

Hi,

 

Suppose i have a dataset 

 

Date                 Val        Count

01/01/19          A            1

02/01/19          B            1

03/01/19          C            1

04/01/19          A            2

05/01/19          D            1

06/01/19          E             1

07/01/19          B             2

08/01/19          A             3

 

I would like to create a calcualted column (count) which counts the number of times a value (Val) appears in the dataset. The count needs to increment by 1 each time it comes across the same value.

 

Any help will be appreciated

 

Thanks

 

1 ACCEPTED SOLUTION
PattemManohar
Community Champion
Community Champion

@Anonymous  Please try this as a New Column.

 

Count = COUNTROWS(FILTER(ALL(Test06),[Date]<=EARLIER(Test06[Date]) && [Val] = EARLIER(Test06[Val])))

image.png





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

Proud to be a PBI Community Champion




View solution in original post

5 REPLIES 5
PattemManohar
Community Champion
Community Champion

@Anonymous  Please try this as a New Column.

 

Count = COUNTROWS(FILTER(ALL(Test06),[Date]<=EARLIER(Test06[Date]) && [Val] = EARLIER(Test06[Val])))

image.png





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

Proud to be a PBI Community Champion




Anonymous
Not applicable

Hi @PattemManohar ,

 

Thank you for your solution.  Suppose I didnt have the date column and just wanted to count based on the Val column purely. How would you modify the formula to do so?

 

Thank you

@Anonymous In that case, try adding an Index field and use that Index column instead of Date field. But if you don't want that too, considering having only [val] column then in that case, you can't get running total but can have grand total count against each val. that appeared in the whole dataset.





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

Proud to be a PBI Community Champion




Hello Sir,

 

I saw your reply on how to count those repeats and it does work; however, I have a table with 2.5 million rows and this approach take a very long time.  Do you have another method that would achive the same reuslts but more efficient for larger data sets?  ~Thank You

Anonymous
Not applicable

That did the trick @PattemManohar !!!!

 

Thank you 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.