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

Calculating the average number of distinct values in a column

Hi there,

 

I have data that looks similar to this:

 

Purchase Order Number:                       Vendor Name:

001                                                          Vendor A

002                                                          Vendor B

003                                                          Vendor B

004                                                          Vendor C

005                                                          Vendor C

006                                                          Vendor C

 

Each purchase order number is a distinct value, but a vendor can have multiple purchase orders. So with this data I am trying to find the average number of purchase orders per vendor. In this case, I would be looking for a DAX formula that would return the answer of 2, since the average count of POs that a vendor has would be 2. Any help is greatly appreciated.

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create measures

distinctount = CALCULATE(DISTINCTCOUNT('Table'[Purchase Order Number]),ALLEXCEPT('Table','Table'[Vendor Name]))

average = AVERAGEX(DISTINCT('Table'[Vendor Name]),[distinctount])

Capture8.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Create measures

distinctount = CALCULATE(DISTINCTCOUNT('Table'[Purchase Order Number]),ALLEXCEPT('Table','Table'[Vendor Name]))

average = AVERAGEX(DISTINCT('Table'[Vendor Name]),[distinctount])

Capture8.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

If my understanding is correct, you can use the following formula

 

Measure = DIVIDE(count('Table'[Order Number]),DISTINCTCOUNT('Table'[Vendor Name]))
 

Eric Ji | Senior Business Intelligence Consultant
www.designmind.com

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.