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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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