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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mmurph16
New Member

Distinct Values

Hello!

 

we had a tricky issue with counting number of duplicate rows in our BI table, we are having a really tough time formulating a DAX code to generate differentiating repeating values. So basically what we want to do is for unique values to display "0" then for multiple repeating numbers, we want to integrate a count value. So if there are repeating values, we want the new row to give a them seperate value. Shown below in our "test" table in excel, the "count" column gives us a count of repeating number. Anyway anyone can help with implementing a formula that would work for us Power Bi?
mmurph16_0-1679596989732.png

Thanks

1 REPLY 1
Anonymous
Not applicable

I don't know how you'd do it in DAX, but in Power Query, you could first Group By Employee Number, use a Count aggregation (let's name it "RowCount" and an All Rows aggregation (let's name it "Details", and then add an Index (beginning at 1) to each of the nested tables, and subtracting 1 from each Index value where the count of rows is 1. So after the Group By step:


Table.TransformColumns(PriorStepOrTableName, "Details", each Table.AddIndexColumn(_, "Count", 1, 1), Int64.Type)

 

Now you can expand the column, but your single row value will be 1 instead of zero. So now you can go


Table.AddColumn(PriorStepOrTableName, "CorrectCount", each if [RowCount] = 1 then 0 else [Count])

 

--Nate

Good to go!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors