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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Delete Hard Coded Columns after PowerQuery GroupBy

Hello Everyone, 

 

Down below I've shared my groupby statement. 

 

GroupBy.png

 

In PowerQuery M this is the code:

 

#"Groupby Casenummer for min_wo" = Table.Group(#"Type to date", {"CaseNumber"}, {{"Min Werkordernummer", each List.Min([wo_number]), type nullable text}, {"ALL", each _, type table [Id=text, CaseNumber=nullable number, AccountId=nullable text, AssetId=nullable text, Type=nullable text, RecordTypeId=nullable text, Status=nullable text, IsClosed=logical, ClosedDate=nullable datetime, OwnerId=text, CreatedDate=datetime, Company_name__c=nullable text, Serienummer__c=nullable text, wo_serial=nullable text, wo_cause=nullable text, wo_dateofvisit=nullable date, wo_downtime=nullable logical, wo_endtime=nullable datetime, wo_starttime=nullable datetime, wo_number=nullable text, wo_enddate=nullable date, wo_startdate=nullable date]}})

I want to make the last line of the code dynamic, because if I add a column in an earlier step, I need to manually do the GroupBy everytime. 

 

Last line (copied from whole statement above):

 

{"ALL", each _, type table [Id=text, CaseNumber=nullable number, AccountId=nullable text, AssetId=nullable text, Type=nullable text, RecordTypeId=nullable text, Status=nullable text, IsClosed=logical, ClosedDate=nullable datetime, OwnerId=text, CreatedDate=datetime, Company_name__c=nullable text, Serienummer__c=nullable text, wo_serial=nullable text, wo_cause=nullable text, wo_dateofvisit=nullable date, wo_downtime=nullable logical, wo_endtime=nullable datetime, wo_starttime=nullable datetime, wo_number=nullable text, wo_enddate=nullable date, wo_startdate=nullable date]}})

 

Is there anyone who can help me with this one?

 

Thanks!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

Did you mean to make the grouped table structure dynamic changes instead of auto generated by M query functions?
If that is the case, you can try to remove the table structure parts, then the result will be recognized as common table type without detailed definitions.

 

#"Groupby Casenummer for min_wo" = Table.Group(#"Type to date", {"CaseNumber"}, {{"Min Werkordernummer", each List.Min([wo_number]), type nullable text}, {"ALL", each _, type table}})

 

Notice: power query will cache the table structure into the query steps and not auto sync. So if your source structure changes, you need to manually check each step to fix the issue caused by these cache structures.

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @Anonymous,

Did you mean to make the grouped table structure dynamic changes instead of auto generated by M query functions?
If that is the case, you can try to remove the table structure parts, then the result will be recognized as common table type without detailed definitions.

 

#"Groupby Casenummer for min_wo" = Table.Group(#"Type to date", {"CaseNumber"}, {{"Min Werkordernummer", each List.Min([wo_number]), type nullable text}, {"ALL", each _, type table}})

 

Notice: power query will cache the table structure into the query steps and not auto sync. So if your source structure changes, you need to manually check each step to fix the issue caused by these cache structures.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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 Solution Authors
Top Kudoed Authors