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 as follows(btw name is irrevelant I think in this example, so thinking of removing that column):
Project Name Point
ABC Test1 30
ABC Test2 10
ABC Test3 10
ABC Test4 20
ABC Test5 30
DEF Test1 20
GHI Test1 10
GHI Test2 20
I want in Powerquery M to group them by Project and get an average, so I have the following result:
(ABC would be 100/5 rows, DEF would be 20/1 Row, GHI would be 30/2
Project Avg
ABC 20
DEF 20
GHI 15
Thanks!
Hi EaglesTony,
I got the desired result by a simple group by and using an average aggregation.
This is how I started:
Then from the "Transform" tab I chose "Group by".
Then I chose the criteria below.
Then I got the final result below.
Use a simple Group By
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnRyVtJRCkktLjEE0sYGSrE6yIJGQNoQXdAYm6AJkDZCFzRFmOni6oZkEVSlu4cnkqAhuqARVGUsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, Name = _t, Point = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Project", type text}, {"Name", type text}, {"Point", Int64.Type}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Project"}, {{"Avg", each List.Average([Point]), type nullable text}})
in
#"Grouped Rows"
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.