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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.