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.
Hi,
I have a table with 366 rows.
I'm trying to calculate the average in a matrix, but I want the average to be calculated from the level below.
For example, currently the average for “Queens” is calculated using all the 336.
I want to calculate the average for Queens using the 5 fruits’ averages shown below.
The average would be found using ( 99.6323, 99.6334, 99.5594, 99.5856, 99.6368) = 99.6095
Does anyone know how to calculate the average using the numbers from the previous level in a matrix?
Solved! Go to Solution.
I think I got it to work. I calculated the average at each level. Here is an example of the average at the highest level.
_a1 =
Hi @Anonymous
Please try
Average over Fruits =
AVERAGEX(
VALUES(Table[Fruits]),
CALCULATE(AVERAGE(Table[Fruits]))
)
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
-----------------------------------------------------
Hi @Anonymous
Did you try my formula? I made a small mistake and adjusted it and it should work. Can you please try and show what happens?
Average over Fruits =
AVERAGEX(
VALUES(Table[Fruits]),
CALCULATE(AVERAGE(Table[Data]))
)
Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!
@ me in replies or I'll lose your thread.
-----------------------------------------------------
Hi, @Anonymous
Please try measure formula like:
Average for Queens =
VAR tab =
SUMMARIZE (
'Table',
'Table'[Team],
'Table'[Country],
'Table'[State],
'Table'[County],
'Table'[Fruit],
"Avg", AVERAGE ( 'Table'[Data] )
)
RETURN
AVERAGEX ( tab, [Avg] )
Result =
IF (
ISINSCOPE ( 'Table'[County] ) && NOT ISINSCOPE ( 'Table'[Fruit] ),
[Average for Queens],
AVERAGE ( 'Table'[Data] )
)
Best Regards,
Community Support Team _ Eason
Hi Eason,
Thanks for the ISINSCOPE suggestion and PBIx file. It was helpful.
Your solution does work however my example was too simple. I need to apply the prior level idea to all levels. I tried to create an average table for each level but don't know how to create a nesting formula to use the prior levels' averages. For example, to find the Team average using the Country Average derived from the State Average derived from the County Average.
Any thoughts? I have the latest file of my work but don't see an option to attach the file.
I think I got it to work. I calculated the average at each level. Here is an example of the average at the highest level.
_a1 =
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |