Forum Discussion

Meneizs's avatar
Meneizs
Frequent Visitor
4 years ago
Solved

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

 

 

 

 

 

 

  • 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. 

     

     


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

2 Replies

  • 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. 

     

     


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

  • Hi,

    This calculated column formula works

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

    Hope this helps.