March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Hi,
I would like to calculate the weighted average values on a matrix. This is a sample dataset:
UserId | CritID | CritSelVal | PoolCritID | PoolSelVal |
1 | 3 | 0.20 | 4 | 5.00 |
1 | 2 | 0.14 | 5 | 7.00 |
1 | 2 | 0.20 | 4 | 5.00 |
1 | 2 | 0.14 | 3 | 7.00 |
1 | 1 | 0.20 | 5 | 5.00 |
1 | 4 | 7.00 | 5 | 0.14 |
1 | 1 | 0.14 | 4 | 7.00 |
1 | 3 | 5.00 | 5 | 0.20 |
1 | 1 | 5.00 | 3 | 0.20 |
1 | 1 | 5.00 | 2 | 0.20 |
1 | 4 | 5.00 | 3 | 0.20 |
1 | 5 | 7.00 | 2 | 0.14 |
1 | 4 | 5.00 | 2 | 0.20 |
1 | 3 | 7.00 | 2 | 0.14 |
1 | 5 | 5.00 | 1 | 0.20 |
1 | 5 | 0.14 | 4 | 7.00 |
1 | 4 | 7.00 | 1 | 0.14 |
1 | 5 | 0.20 | 3 | 5.00 |
1 | 3 | 0.20 | 1 | 5.00 |
1 | 2 | 0.20 | 1 | 5.00 |
This is the matrix view, using CritID and PoolCritID. Values in Matrix is the PoolSelVal
1 | 2 | 3 | 4 | 5 | |
1 | 5.000 | 5.000 | 0.143 | 0.200 | |
2 | 0.200 | 0.143 | 0.200 | 0.143 | |
3 | 0.200 | 7.000 | 0.200 | 5.000 | |
4 | 7.000 | 5.000 | 5.000 | 7.000 | |
5 | 5.000 | 7.000 | 0.200 | 0.143 | |
Total | 12.400 | 24.000 | 10.343 | 0.686 | 12.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
1 | 2 | 3 | 4 | 5 | Weighted Average | |
1 | 0.000 | 0.208 | 0.483 | 0.208 | 0.016 | 0.23 |
2 | 0.016 | 0.000 | 0.014 | 0.292 | 0.012 | 0.08 |
3 | 0.016 | 0.292 | 0.000 | 0.292 | 0.405 | 0.25 |
4 | 0.565 | 0.208 | 0.483 | 0.000 | 0.567 | 0.46 |
5 | 0.403 | 0.292 | 0.019 | 0.208 | 0.000 | 0.23 |
Thanks
Solved! Go to Solution.
have you tried looking at the below solution
https://community.powerbi.com/t5/Desktop/Weighted-average-table-calculation/m-p/772223
Proud to be a Super User!
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))
have you tried looking at the below solution
https://community.powerbi.com/t5/Desktop/Weighted-average-table-calculation/m-p/772223
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
91 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
73 | |
68 |