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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
tejasp
Frequent Visitor

Get result for group based on values in subgroups

Hi Team,

I am looking for a solution in power query where I will be able to get the result for main group based on the subgroup value.

 

column1column2column3column4
Group1Sub-Group1MetPartially Met
Group1Sub-Group1Partially MetPartially Met
Group1Sub-Group1Partially MetPartially Met
Group2Sub-Group2MetNot Met
Group2Sub-Group2Partially MetNot Met
Group2Sub-Group2Partially MetNot Met
Group2Sub-Group2Not MetNot Met

 

In above example, column4 is result column based on the values from column3. If all values of subgroup are met then group value should be met, simillary if any of the subgroup have value partially met, or not met then the value of the group should be Partially met or not met, else met. Is it possible in power query?

 

Thanks,

 

1 ACCEPTED SOLUTION
Payeras_BI
Solution Sage
Solution Sage

Hi @tejasp ,

One possible solution:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci/KLy0wVNJRCi5N0oVzfFNLlGJ1cMkGJBaVZCbm5FQqkKXOCFmdEbptGLLEmkKsOr/8EoiKWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [column1 = _t, column2 = _t, column3 = _t]),
    #"Grouped Rows" = Table.Group(Source, {"column1", "column2"}, {{"All", each _}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Column4", each let List = [All][column3] in 
if List.Contains(List,"Not Met") then "Not Met" 
else if List.Contains(List, "Partially Met") then "Partially Met" else "Met"),
    #"Expanded All" = Table.ExpandTableColumn(#"Added Custom", "All", {"column3"}, {"column3"})
in
    #"Expanded All"
If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

View solution in original post

1 REPLY 1
Payeras_BI
Solution Sage
Solution Sage

Hi @tejasp ,

One possible solution:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci/KLy0wVNJRCi5N0oVzfFNLlGJ1cMkGJBaVZCbm5FQqkKXOCFmdEbptGLLEmkKsOr/8EoiKWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [column1 = _t, column2 = _t, column3 = _t]),
    #"Grouped Rows" = Table.Group(Source, {"column1", "column2"}, {{"All", each _}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Column4", each let List = [All][column3] in 
if List.Contains(List,"Not Met") then "Not Met" 
else if List.Contains(List, "Partially Met") then "Partially Met" else "Met"),
    #"Expanded All" = Table.ExpandTableColumn(#"Added Custom", "All", {"column3"}, {"column3"})
in
    #"Expanded All"
If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.