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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Christian_Houen
Frequent Visitor

Calculation of weighted average by multiple selected groups

Hi

 

In close resemblence to this request I would love some help on how to calculate an average of multiple selected groups.

Say I have the following data:

Capture.PNG


I want the weighted average of the price grouped by 1,2,3 (so I can use it for drill down on my graph).

Issue is that I have many more columns which I do not want to be part of the grouping

 

What could be a solution?

1 ACCEPTED SOLUTION

Look at Table22



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Christian_Houen,

 

What do you mean "grouped by 1,2,3" ? And what do you mean "I have many more columns which I do not want to be part of the grouping"? Which columns are not wanted? Please show us your desired output.

 

Regards,

Yuliana Gu

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

Hi Yuliana

 

I'll try and expand my mock data table a little bit.


Capture.PNG

 

So, my desired output is the weighted average price (with formula shown).

My firm may sell multiple of the same item on the same purchase order at different prices in the same country and in the same region.

I want to get an average for each product in each country and each region. I included Russia in both Europe and Asia as the real data is structured in the way that the value in secondary column may appear in relation to all values in the first column.

So weighted average price by item ("Name"), by ("Country") and by ("Region"). I do however have more data columns ("Column A") and ("Column B") and many more, which I do not want to be included in the grouping. E.g. I don't want the average price by Name, Country, Region and Column A (or any other column).

Let me know if I still do not explain this clearly enough.


Look at Table22



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

Weighted by what?

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg 

Please see answer below - thank you!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.