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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

DAX -Average Calculation for a category not matching up to sub-category level

I have a dataset on revenue and volume of certain SKUs, rolled-up into product categories, and then into customers. I am trying to calculate average selling price (formula:revenue by volume) for each SKU, and subsequently for each category, and eventually for each customer. 

 

The issue is that ASP at the SKU level is calculated correctly, however the numbers don't make sense at category, and customer level. For example, in 2017, it says ASP for category 1 is 0.90, when in fact, category 1 is made up of many SKU with majority of them havnig 20+ ASP.

 

Both the sample dataset and the PBI report can be accessed through here: Data  

 

Thanks in advance!

1.jpg2.jpg

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

hi  @Anonymous 

For your case, just add a new measure as below:

Measure 3 = 
var _table=SUMMARIZE(Sheet1,Sheet1[Customer Name],Sheet1[Product Category],Sheet1[Product],Sheet1[Year],"_value",[ASP])  return
AVERAGEX(_table,[_value])

Result:

1.JPG

Regards,

Lin

Community Support Team _ Lin
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

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

For your case, just add a new measure as below:

Measure 3 = 
var _table=SUMMARIZE(Sheet1,Sheet1[Customer Name],Sheet1[Product Category],Sheet1[Product],Sheet1[Year],"_value",[ASP])  return
AVERAGEX(_table,[_value])

Result:

1.JPG

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi Greg - Thanks for the quick reply. Unfortunately, my issue is different to the solution you were referencing to. 

 

The issue is not with the incorrect 'Total' row that falls at the bottom of a table/matrix, but rather a case of an aggregation of a measure, which is then further aggregated. In my case, average selling price by each SKU, which then aggregates to average selling price by product category, and subsequently by customer.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.