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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
navafolk
Helper III
Helper III

Numbering (conditional) duplicates without supporting column

Hi pros,

I tried to create a column to number (multi conditions) duplicates

The Numbering Duplicates should be looked like this:

Tran NameDate[expect] Numbering Duplicates
VCCB

01 Jan 2020

1
VCCB01 Jan 20202
VCBF02 Jan 20201
VCCB03 Jan 2020

1

TCBF03 Jan 20201
TCBF03 Jan 20202
TCBF03 Jan 20203

This thing is easilly done in excel =COUNTIFS($A$1:A2,A2,$B$1:B2,B2) (assumed data started in A1)

Please help to do this without supporting column(s), thank you.

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @navafolk 

 

Dax will identify the duplicates as the same row. It is unavailable to reach your requirement without creating an index column. I'd like to suggest you create an index column.

 

You may click 'Edit Query', go to Query Editor, click 'Add Columns' ribbon, 'Index column'.

a1.png

 

You may create a measure as follows.

Numbering Duplicates = 
var _index = MAX('Table'[Index])
var _name = MAX('Table'[Tran Name])
var _date = MAX('Table'[Date])
return
IF(
    ISFILTERED('Table'[Tran Name]),
    COUNTROWS(
        FILTER(
            ALL('Table'),
            'Table'[Index]<=_index&&
            'Table'[Tran Name] = _name&&
            'Table'[Date] = _date
        )
    )
)

 

Result:

a2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-alq-msft
Community Support
Community Support

Hi, @navafolk 

 

Dax will identify the duplicates as the same row. It is unavailable to reach your requirement without creating an index column. I'd like to suggest you create an index column.

 

You may click 'Edit Query', go to Query Editor, click 'Add Columns' ribbon, 'Index column'.

a1.png

 

You may create a measure as follows.

Numbering Duplicates = 
var _index = MAX('Table'[Index])
var _name = MAX('Table'[Tran Name])
var _date = MAX('Table'[Date])
return
IF(
    ISFILTERED('Table'[Tran Name]),
    COUNTROWS(
        FILTER(
            ALL('Table'),
            'Table'[Index]<=_index&&
            'Table'[Tran Name] = _name&&
            'Table'[Date] = _date
        )
    )
)

 

Result:

a2.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.