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

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

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