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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Anonymous
Not applicable

Count duplicates across distinct records

Hi community,

 

I've been searching the forum and the net for quite some time but am obviously being thick in how to look for an answer.

 

Assuming I have a table as below: I want to have a calculated column (either in DAX or M) that will count how many times the value in the ABN column exists across separate Vendor IDs. 

 

Vendor IDBankABNCount of Vendor with duplicate ABN
AA1115566     2
AA2115566     2
AB3115500     2
AC4115566     2
AD5115500     2

 

In essence, the fact that Vendor ID has the same ABN across two lines is normal (and irrelevant), what I want is to flag that another Vendor ID has the same ABN. Same for vendor AB, I want to flag that vendor AD has the same ABN.

 

THe intent here is to provide a table with all Vendor IDs that have duplicate ABN, so I'd be ok with a new table showing this.


Thanks in advance for your help.
BBK

1 ACCEPTED SOLUTION
dk_dk
Super User
Super User

Hi @Anonymous ,

I have a solution with just the Power Query editor, although depending on the size of your dataset it might not be the best performance wise:

 

  1. Duplicate your query.
  2. Select the ABN and Vendor ID columns and remove duplicate rows.
  3. Group by ABN and for the value use Count Rows. You should have a table that contains each ABN once and counts how many unique Vendor IDs they were listed for.
  4. Merge back to the original query on the ABN column.


Alternatively you could try referencing your original query instead of duplicating. This way you wont be able to merge it back, but you could load both tables and then use LOOKUPVALUES in a calculated column to get the count into your original table. I am honestly not sure which method would be better for performance.


I hope this helps, let me know if you have any questions.





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

Proud to be a Super User!





View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi, @Anonymous ,

The following DAX might work for you:

Count of Vendor with duplicate ABN = 
CALCULATE(DISTINCTCOUNT('Table'[Vendor ID]),
ALLEXCEPT('Table','Table'[ABN])
)

The final output is shown in the following figure:

vjunyantmsft_0-1698201379543.png

Best Regards,

Dino Tao

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

dk_dk
Super User
Super User

Hi @Anonymous ,

I have a solution with just the Power Query editor, although depending on the size of your dataset it might not be the best performance wise:

 

  1. Duplicate your query.
  2. Select the ABN and Vendor ID columns and remove duplicate rows.
  3. Group by ABN and for the value use Count Rows. You should have a table that contains each ABN once and counts how many unique Vendor IDs they were listed for.
  4. Merge back to the original query on the ABN column.


Alternatively you could try referencing your original query instead of duplicating. This way you wont be able to merge it back, but you could load both tables and then use LOOKUPVALUES in a calculated column to get the count into your original table. I am honestly not sure which method would be better for performance.


I hope this helps, let me know if you have any questions.





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

Proud to be a Super User!





Anonymous
Not applicable

Thanks very much @dk_dk , it worked a treat 🙂

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.