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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
zaforir2002
Helper I
Helper I

Distinct Average

Hi,

 

I am using Excel PowerPivot from the tabular data model and need to do average on distinct records, although I have gone trough with many suggestions are available online, but not getting the correct output. 

 

Sample table

prodqty
Apple10
Apple15
Apple10
Organe5
Organe12
Organe12
Organe12
Banana8
Banana

8

 

Result I am getting

 

prodmy_avg_qty_return
Apple10.22222
Orange10.22222
Banana10.22222

 

Result I am expecting

 

prodavg_qty_expected 
Apple11.66667
Orange10.25
Banana8
BI Analyst and Developer @ Queen Mary University of London, UK.
1 ACCEPTED SOLUTION
Datatouille
Solution Sage
Solution Sage

Hi @zaforir2002

 

I think you have a confusion between a calculated column and a measure.

 

If you create the DAX measure:

AvgQty = Average(YourTable[Qty] ) and bring in this measure in a pivot table, you'll get the correct result thanks to filter context.

View solution in original post

5 REPLIES 5
Datatouille
Solution Sage
Solution Sage

Hi @zaforir2002

 

I think you have a confusion between a calculated column and a measure.

 

If you create the DAX measure:

AvgQty = Average(YourTable[Qty] ) and bring in this measure in a pivot table, you'll get the correct result thanks to filter context.

Thanks, @Datatouille,

 

I have used it in a measure, not in the calculated column, but the results are same for each prod :(.

BI Analyst and Developer @ Queen Mary University of London, UK.

Do you have everything in the same table or do you bring in products from another table ?

In that case, you need to create a (1 to Many) Relationship between Products and your Quantity Table.

All is from same table @Datatouille

BI Analyst and Developer @ Queen Mary University of London, UK.

Will you please share the file ? because it should work !

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors