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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Meneizs
Frequent Visitor

Duplicate rows cummulative

I have a dataset that's contains duplicates rows, that i need to maintain for some analysis.
My table is something like this:

CONTLOTEDATECONT/LOTE
100091012607/07/202210009-10126
100091012626/05/202210009-10126
100091012619/04/202210009-10126
100091012610/05/202210009-10126
100141013815/07/202210014-10138
100141013820/04/202210014-10138
100141013802/06/202210014-10138

And i need to add a suffix on duplicateds rows, ordered by Date. Something like this:

CONTLOTEDATECONT/LOTEDUPLICATED
100091012607/07/202210009-101264
100091012626/05/202210009-101263
100091012619/04/202210009-101261
100091012610/05/202210009-101262
100141013815/07/202210014-101383
100141013820/04/202210014-101381
100141013802/06/202210014-101382

 

I've already tried this column, but unsuccessful...

Column = CALCULATE (DISTINCTCOUNT ( Table1[Cont/Lote] ),
FILTER (Table1,
Table1[Date] = EARLIER ( Table1[Date] )
&& Table1[Cont/Lote] < EARLIER ( Table1[Cont/Lote] )))
+ 1

 

 

 

 

 

 

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

Based on your output, it seems you are looking for is Row Number by Group.

 

Row Number by Group - Static Column = 
 RANKX( 
        Filter('Table', 
               [CONT/LOTE] = Earlier('Table'[CONT/LOTE])
        )
        , 'Table'[DATE], , ASC, dense)

 

It took me a while to understand, as I was trying to correct the DAX. 

sevenhills_0-1654820520793.png

 

 


Tip: To post sample data, do copy and paste from Excel. 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This calculated column formula works

=CALCULATE(COUNTROWS(Data),FILTER(Data,Data[CONT]=EARLIER(Data[CONT])&&Data[DATE]<=EARLIER(Data[DATE])))

Hope this helps.

Untitled.png


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

Based on your output, it seems you are looking for is Row Number by Group.

 

Row Number by Group - Static Column = 
 RANKX( 
        Filter('Table', 
               [CONT/LOTE] = Earlier('Table'[CONT/LOTE])
        )
        , 'Table'[DATE], , ASC, dense)

 

It took me a while to understand, as I was trying to correct the DAX. 

sevenhills_0-1654820520793.png

 

 


Tip: To post sample data, do copy and paste from Excel. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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