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
Jacodw0901
New Member

Weighted average calculation

Hi,

 

I would like to calculate the weighted average values on a matrix. This is a sample dataset:

 

UserIdCritIDCritSelValPoolCritIDPoolSelVal
130.2045.00
120.1457.00
120.2045.00
120.1437.00
110.2055.00
147.0050.14
110.1447.00
135.0050.20
115.0030.20
115.0020.20
145.0030.20
157.0020.14
145.0020.20
137.0020.14
155.0010.20
150.1447.00
147.0010.14
150.2035.00
130.2015.00
120.2015.00

 

This is the matrix view, using CritID and PoolCritID. Values in Matrix is the PoolSelVal

 
 
 12345
1 5.0005.0000.1430.200
20.200 0.1430.2000.143
30.2007.000 0.2005.000
47.0005.0005.000 7.000
55.0007.0000.2000.143 
Total12.40024.00010.3430.68612.343

I have a problem calculating the weighted average in the table below as the calculation in the row is not the same calculation in the total column

Normalised based on PoolCritID (Column) Column Total used to calculate the normalised value

Weighted average should be the average for each row excluding the 0

 

 12345Weighted Average
10.0000.2080.4830.2080.0160.23
20.0160.0000.0140.2920.0120.08
30.0160.2920.0000.2920.4050.25
40.5650.2080.4830.0000.5670.46
50.4030.2920.0190.2080.0000.23

 

Thanks

1 ACCEPTED SOLUTION
negi007
Community Champion
Community Champion

@Jacodw0901 

 

have you tried looking at the below solution

 

https://community.powerbi.com/t5/Desktop/Weighted-average-table-calculation/m-p/772223




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

You can use HASONEVALUE to get a different result in the total.

 

For example, I used this for one of my averages.  Because I wanted my total to be the total of all the averages, not an average of all the averages.

 

IF(HASONEVALUE(Items[Item]),AvgCost , SUMX(VALUES(Items[Item]),AvgCost))

 

negi007
Community Champion
Community Champion

@Jacodw0901 

 

have you tried looking at the below solution

 

https://community.powerbi.com/t5/Desktop/Weighted-average-table-calculation/m-p/772223




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

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.