Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi All,
How to return a count of 1 in another column having duplicates and non-duplicates? Duplicates should only be counted once just as shown in the table below:
ID# | Count |
ID1 | 1 |
ID2 | 1 |
ID1 | |
ID3 | 1 |
ID1 |
Hi, the code does not return count of 1 with duplicates.
Not sure if your question is well phrased, believe you are looking to count the unique values for column ID#, if so this can be achieved even without DAX, within the visual just select Count (Distinct).
To achieve this in Power BI using DAX, you can create a calculated column that calculates the count based on your conditions. You can use the following DAX formula to create such a calculated column:
Count Column =
VAR CurrentID = YourTable[ID#]
VAR DistinctCount = COUNTROWS(FILTER(YourTable, YourTable[ID#] = CurrentID))
RETURN
IF(DistinctCount > 1, BLANK(), 1)
Here's how the formula works:
You should replace YourTable with the name of your actual table and ID# with the name of your actual ID column.
Once you create this calculated column, it will give you the desired count of 1 for both duplicates (counted only once) and non-duplicates in a separate column.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
80 | |
76 | |
60 | |
36 | |
33 |
User | Count |
---|---|
91 | |
60 | |
59 | |
49 | |
45 |