Don't miss your chance to take exam DP-600 or DP-700 on us!
Request nowLearn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi I have a table of people information from various countries and column 'duplicates' is a true/false column that indicates if that record has a duplicate in the dataset based on their name. (e.g. if 2 records have the same name, value in duplicates is true)
I want to count the number of duplicates for each country (aka counting the number of rows where duplicates='true' grouped by the country)
How can i do so?
Hello,Bibiano_Geraldo and danextian ,thanks for your concern about this issue.
Your answer is excellent!
And I would like to share some additional solutions below.
Hi,@kellyylx , I am glad to help you.
Like this?
I verified the suggestions of others as well, and the end result is as follows:
Count of Duplicates =
CALCULATE(
COUNTROWS('TableTest'),
'TableTest'[duplicates] = TRUE()
)
Count_Duplicates02 =
CALCULATE (
COUNTROWS ( 'TableTest'),
KEEPFILTERS ('TableTest'[duplicates] = TRUE () )
)
M_all =
CALCULATE (
COUNTROWS ( 'TableTest' ),
FILTER ( ALL ( 'TableTest' ), 'TableTest'[duplicates] = TRUE () )
)
this is my test data:
|
Name |
Country |
duplicates |
Index |
|
John Doe |
USA |
True |
1 |
|
Jane Smith |
Canada |
False |
2 |
|
John Doe |
USA |
True |
3 |
|
Alice Johnson |
Canada |
True |
4 |
|
Bob Brown |
USA |
False |
5 |
|
Alice Johnson |
Canada |
True |
6 |
|
Charlie Brown |
USA |
False |
7 |
|
David Wilson |
Canada |
False |
8 |
|
Eva Green |
USA |
False |
9 |
|
Frank White |
Canada |
False |
10 |
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian
Hi @kellyylx
Create this measure then add that to a table viz together with the country column
CALCULATE (
COUNTROWS ( 'table' ),
KEEPFILTERS ( 'table'[duplicates] = TRUE () )
)
I am assuming that duplicates column is of type boolean/logical. If not, replace TRUE() with "true"
Hi @kellyylx ,
Create a measure with the following DAX:
Count of Duplicates =
CALCULATE(
COUNTROWS('YourTable'),
'YourTable'[duplicates] = TRUE()
)Add this measure to a visual, like a table, with the Country column to see the count of duplicates for each country.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 51 | |
| 40 | |
| 37 | |
| 14 | |
| 14 |
| User | Count |
|---|---|
| 85 | |
| 69 | |
| 38 | |
| 29 | |
| 27 |