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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Unique number of customers

Hi

I've trying to achieve the following requirement.

I've a table of Part numbers and customers who bought those part numbers. I wish to create a table that contains unique part numbers and next to it, number of unique customers per part number.

 

Below is example of the data:

Part #Customer
A-123Customer A
A-123Customer B
A-123Customer C
A-123Customer D
B-456Customer B
B-456Customer B
B-456Customer A
B-456Customer A
C-789Customer B
C-789Customer C
C-789Customer C
C-789Customer A

 

Below is example of the result I wish to get.

 

Part ## of Unique Customers
A-1234
B-4562
C-7893
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You can create a measure

distinctcount(Table[Customer])

 

And use that in visual with item #

 

Or create a new tbale

summarize(table, Table[Item #], "Cust", distinctcount(Table[Customer])  )

View solution in original post

3 REPLIES 3
TheoC
Super User
Super User

Hi @Anonymous 

 

You can use Measure = DISTINCTCOUNT ( Table[Customer] ) to achieve this.  Just create a table with Part # on left and the new measure on the right.

 

In addition to the above, you can simply have the Table visual with the Part Number on the left, then drag the Customer field on the visual as well.  Click the down arrow on Customer, then click on Count (Distinct).  This will achieve the same outcome without any code.

 

TheoC_0-1643943557301.png

 

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

amitchandak
Super User
Super User

@Anonymous , You can create a measure

distinctcount(Table[Customer])

 

And use that in visual with item #

 

Or create a new tbale

summarize(table, Table[Item #], "Cust", distinctcount(Table[Customer])  )

Anonymous
Not applicable

Interesting! @amitchandak 

I had similar approach where I tried to use 

VALUES('table'[Item #]) instead of Table[Item #]
So, does Table[Item #] return unique values when using Summarize?
 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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