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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Susan513
Helper II
Helper II

Roll up average per 2 categories- custom column

I am looking to get the average SPI per project, per bucket and put that value in the summary row - this is the row with the same task name as the bucket. I am looking to put the data into a Gantt chart - so prefer to utilize this in a custom column if at all possible.

 

I need to isolate the project, then group the buckets, return the average per bucket, and put this value in the project row where the bucket name is the task name. I am trying to break it down, but just learning and could use some help. I am not sure why Microsoft doesn't include this ability in Project Web any longer.

 

Sample data:

This is the result section I am trying to calculate. I have manually done the SPI average calculations in excel:

ProjectBucketsTask NameSPICode needed:
AppleInitiationInitiation0.99Average of Apple Initiation task SPI
PearInitiationInitiation0.89Average of Pear Initiation task SPI
BananaInitiationInitiation0.57Average of Banana Initiation task SPI
ApplePlanningPlanning0.94Average of Apple Planning task SPI
PearPlanningPlanning0.72Average of Pear Planning task SPI
BananaPlanningPlanning0.77Average of Banana Planning task SPI
AppleExecutionExecution Average of Apple Execution task SPI
PearExecutionExecution Average of Pear Execution task SPI
BananaExecutionExecution Average of Banana Execution task SPI

 

This is the additional data (same query)  - where the averages are coming from:

ProjectBucketsTask NameSPI
AppleInitiationTask 10.98
PearInitiationTask 10.80
BananaInitiationTask 10.40
ApplePlanningTask 10.99
PearPlanningTask 10.50
BananaPlanningTask 10.89
AppleExecutionTask 1 
PearExecutionTask 1 
BananaExecutionTask 1 
AppleInitiationTask 21.00
PearInitiationTask 20.88
BananaInitiationTask 20.45
ApplePlanningTask 20.97
PearPlanningTask 20.67
BananaPlanningTask 20.54
AppleExecutionTask 2 
PearExecutionTask 2 
BananaExecutionTask 2 
AppleInitiationTask 30.99
PearInitiationTask 30.98
BananaInitiationTask 30.87
ApplePlanningTask 30.85
PearPlanningTask 30.99
BananaPlanningTask 30.88
AppleExecutionTask 3 
PearExecutionTask 3 
BananaExecutionTask 3 

 

All this data is in one query in Power BI named PW Tasks w/ SPI

 

Appreciate any insight. It seems I need to group by project, then group by bucket, then calculate the average. I am just not certain best way to do this or if possible in a custom column and then have the visual be the Gantt chart. I feel like a measure would be easier - but not sure I can use the data in a Gantt if a measure is used.

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @Susan513, check this:

 

Output

dufoq3_0-1737565102816.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jdJPC4IwGMfxtyI7i8z9ye1Y0KGbh27DwwiJkSwpg15+o8dCxT0TLxO+8BsfNYbs+75rSU5O3g3ODu7uw8vZPm9ZGQ600Io0uSF1ax9Ipei3OlgfHqQT0P1G68567/x1Mamnk+uNXAyuV0rP5o7v9vJaXiqbjiHFfwpp4pgsHMqCUhyTwa1VChM6IVFMiHSFYUKzq3BMqKTAMVkSk23AZBsw+cpvEq2SmNCpCsUcI4lhzq4VxeTTbxzF5ElMvgFzbJoP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, Buckets = _t, #"Task Name" = _t, SPI = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"SPI", type number}}, "en-US"),
    GroupedRows = Table.Group(ChangedType, {"Project", "Buckets"}, {{"T", each _{0} & [Task Name = [Buckets]{0}, SPI = List.Average([SPI])] , type table}}),
    CombinedT = Table.FromRecords(GroupedRows[T], Value.Type(Table.FirstN(ChangedType, 0)))
in
    CombinedT

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

4 REPLIES 4
dufoq3
Super User
Super User

Hi @Susan513, check this:

 

Output

dufoq3_0-1737565102816.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("jdJPC4IwGMfxtyI7i8z9ye1Y0KGbh27DwwiJkSwpg15+o8dCxT0TLxO+8BsfNYbs+75rSU5O3g3ODu7uw8vZPm9ZGQ600Io0uSF1ax9Ipei3OlgfHqQT0P1G68567/x1Mamnk+uNXAyuV0rP5o7v9vJaXiqbjiHFfwpp4pgsHMqCUhyTwa1VChM6IVFMiHSFYUKzq3BMqKTAMVkSk23AZBsw+cpvEq2SmNCpCsUcI4lhzq4VxeTTbxzF5ElMvgFzbJoP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, Buckets = _t, #"Task Name" = _t, SPI = _t]),
    ChangedType = Table.TransformColumnTypes(Source,{{"SPI", type number}}, "en-US"),
    GroupedRows = Table.Group(ChangedType, {"Project", "Buckets"}, {{"T", each _{0} & [Task Name = [Buckets]{0}, SPI = List.Average([SPI])] , type table}}),
    CombinedT = Table.FromRecords(GroupedRows[T], Value.Type(Table.FirstN(ChangedType, 0)))
in
    CombinedT

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Thank you for putting this together - it doesn't seem to work in a custom column and I am not able to utilize the link to 'learn how to use'

dufoq3_1-1737571575911.png

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Susan513
Helper II
Helper II

Temporary solution: I made a copy of the query, grouped by project and bucket. Then I can show the average for the SPI field. I am not a fan of duplicating a query essentially, but I believe this is going to give me the correct data for now.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors