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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
superjam
Helper II
Helper II

Count repeated values on three columns

Hello:

 

I have a "Table" with three columns, A, B and C, filled with many different string values.

I want to find how many rows of that table have all three columns equal to another row in the table. In other words, find rows with duplicate "A+B+C". In a visual I would need a number, indicating how many non unique values there are, combining the three columns.

Is there a formula to achieve this or do I have to concatenate all three columns in one first and then somehow count the duplicates?

 

Thank you very much and regards.

5 REPLIES 5
tamerj1
Super User
Super User

Hi @superjam 
In general that depends on the filter context which essentially depens on the visual itself. However, The following should work in a card visual

Count =
COUNTROWS (
    DISTINCT ( SELECTCOLUMNS ( "A", 'Table'[A], "B", 'Table'[B], "C", 'Table'[C] ) )
)
superjam
Helper II
Helper II

Hello,

 

Just after posting the last response, I figured it out: create a new column concatenating the three columns and then use the idea of @FreemanZ to calculate the duplicate ones. 

hi @superjam 

DISTINCT also accept table as argument.

FreemanZ
Super User
Super User

hi @superjam 

try like:
Measure =
COUNTROWS(TableName)-
COUNTROWS(DISTINCT(TableName))

Thank you, @FreemanZ 

 

The function DISTINCT() counts unique values in one column of the table. So, your measure gives the repeated values in one column.

 

But how about the following example:

superjam_0-1678277627664.png

Only one row is duplicated (marked in yellow), because only in that case all three columns are equal with each other. I hope this clarifies the problem.

 

Thanks again. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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