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
o59393
Post Prodigy
Post Prodigy

Group by gives error - Power Query

Hi all

 

I am doing a group by ID in Power Query with the following code:

 

 

= Table.Group(
#"Changed Type", {"Id"}, 
{
{"Title", each Text.Combine(List.Distinct([Title]),", ")}, 
{"Status", each Text.Combine(List.Distinct([Status]),", ")}, 
{"Category", each Text.Combine(List.Distinct([Category]),", ")},
{"PO Placed?", each Text.Combine(List.Distinct([#"POplaced?"]),", ")},
{"Project Type", each Text.Combine(List.Distinct([Project Type]),", ")},
{"Zone", each Text.Combine(List.Distinct([Zone]),", ")}, 
{"Region", each Text.Combine(List.Distinct([Region]),", ")},
{"Country", each Text.Combine(List.Distinct([Country]),", ")}, 
{"Bottler", each Text.Combine(List.Distinct([Bottler]),", ")},
{"Package", each Text.Combine(List.Distinct([Package]),", ")},
{"OEM", each Text.Combine(List.Distinct([OEM]),", ")},
{"LineSpeed", each Text.Combine(List.Distinct([LineSpeed]),", ")},
{"Description", each Text.Combine(List.Distinct([Description]),", ")},
{"Annual Capacity (Unit Cases)", each List.Max([#"Annual Capacity (Unit Cases)"]), type nullable number}, 
{"CAPEX (USD)", each List.Max([#"CAPEX (USD)"]), type nullable number}, 
{"Purchase Order Date", each List.Max([Purchase Order Date]), type nullable date}, 
{"Estimated Start-Up Date", each List.Max([#"Estimated Start-Up Date"]), type nullable date}}
)

 

 

Everything works well except for the region column, which was added with a merged columns feature as seen below:

 

o59393_0-1693713338925.png

 

 

Here is the error it shows:

 

o59393_1-1693713404824.png

Expression.Error: The column 'Region' of the table wasn't found.
Details:
Region

 

What could be wrong?

 

Please click on the photos to zoom in.

 

Thanks.

2 ACCEPTED SOLUTIONS
OwenAuger
Super User
Super User

@o59393 

Your Grouped Rows1 step appears to be referring to the Changed Type step, which is not the immediately preceding step, which is presumably not as intended.

 

Try changing the code of the step to:

= Table.Group(
#"Expanded Region"
...

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

danextian
Super User
Super User

Hi @o59393,

 

Your Group By is referencing #"Changed Type" applied step. The merging and expanding came after that so [Region] still didn't exist before that thus the error. Replace it with #"Expanded Region"

danextian_0-1693717382196.png

danextian_1-1693717397770.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
o59393
Post Prodigy
Post Prodigy

Thank you both! @danextian  @OwenAuger 

danextian
Super User
Super User

Hi @o59393,

 

Your Group By is referencing #"Changed Type" applied step. The merging and expanding came after that so [Region] still didn't exist before that thus the error. Replace it with #"Expanded Region"

danextian_0-1693717382196.png

danextian_1-1693717397770.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
OwenAuger
Super User
Super User

@o59393 

Your Grouped Rows1 step appears to be referring to the Changed Type step, which is not the immediately preceding step, which is presumably not as intended.

 

Try changing the code of the step to:

= Table.Group(
#"Expanded Region"
...

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.