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

Join 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.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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