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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to do a unique count per single item?

Dear all,

 

I am seeking for a solution to get a unique count for the following situation:

 

I have a customer table with main customer number and a an additional customer delivery number:

 

Main customer numberDelivery customer number
111123
111134
111145
222234
222245
333345

 

The final result should be a measure showing for the following main customer number the following output:

 

111 ---> unique count of 3 delivery customer numbers

222 ---> unique count of 2 delivery customer numbers

333---> unique count of 1 delivery customer number

 

Any suggestion is welcome how to fix it.

 

Thanks!

1 ACCEPTED SOLUTION
mangaus1111
Solution Sage
Solution Sage

Hi @Anonymous ,

I think you can use simply the measure COUNTROWS('Table') and put it in matrix with the Main Customer Number column in the row.

 

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

View solution in original post

15 REPLIES 15
mangaus1111
Solution Sage
Solution Sage

Like in this example

mangaus1111_0-1667902068592.png

 

Anonymous
Not applicable

Thanks, but it still returns the total number of all rows back to each main customer number. Maybe I do something wrong.

You need to create a measure, not a colum

Hi @Anonymous ,

can you send me a screenshot of your wrong result?

Anonymous
Not applicable

Herewith a screenshot:

 

Power_BI_Adapt_0-1667913164454.png

 

'Hoofd klantnummer' = Main customer number and 'Aantal afleverklantnummers' = Number delivery customer numbers'.

Anonymous
Not applicable

'Hoofd klantnummer' is soueced from table 'Dim Klant' en 'Aantal afleverklantnummers' is a measure written in the following way:

Aantal afleverklantnummers = COUNTROWS('Dim Afleverklant')
 
Table Dim Afleverklant is containing the delivery customer number

Hi @Anonymous ,

do you have a 1 to many relationship between Dim Klant  and Dim Afleverklant?

if you send me a sample file with no sensitive data I can try to give you further help

Anonymous
Not applicable

Hi @Anonymous ,

try to delete this row from your Delivery Table

mangaus1111_0-1667985301056.png

 

In my file the measure is working. If you want I can send you my file

mangaus1111_0-1667986479350.png

 

Anonymous
Not applicable

Thanks. If you could send your file, I will appreciate.

Anonymous
Not applicable

@mangaus1111: yes, true, a one to many relationship (Dim Klant (1) to Dim Afleverklant (many).

mangaus1111
Solution Sage
Solution Sage

Hi @Anonymous ,

I think you can use simply the measure COUNTROWS('Table') and put it in matrix with the Main Customer Number column in the row.

 

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

Anonymous
Not applicable

It works!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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
Top Kudoed Authors