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
GuillaumeBD
Frequent Visitor

Power query grouping all

Hello, I'm grouping with the "All rows" option. The M Code however will select all field individually. If I add a column to my data source, I need to add it to the code. Is there an option to have the All option in the M Code instead of every single field? Thank you

 

GuillaumeBD_0-1699381544978.png

 

M Code

 

#"Lignes groupées1" = Table.Group(#"Valeur remplacée1", {"Adresse"}, {{"Nouveau", each Table.RowCount(_), Int64.Type}, {"Min Date", each List.Min([Date created]), type datetime}, {"T", each _, type table [Date created=datetime, Type=nullable text, Adresse=nullable text, Quartier=text, Lien=text]}}),


#"T développé1" = Table.ExpandTableColumn(#"Lignes groupées1", "T", {"Date created", "Type", "Adresse", "Quartier", "Lien"}, {"Date created", "Type", "Adresse.1", "Quartier", "Lien"}),

 

1 ACCEPTED SOLUTION

Hello @Anonymous , after the group step that you suggested, there is a simple solution for the expand all. You need to delete the original column (In this case "Address") before it reappears with the expand step. For the expand step, here's a good tutorial on how to do it.

 

https://goodly.co.in/expand-all-columns-dynamically-power-query/

 

Thank you

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @GuillaumeBD,

In fact, power query will cache the table structure in the query steps and these structures not auto change.

For your requirement, you can try to remove the table structure definition part and modify the 'expand field' step to use 'Table.ColumnName' function to dynamic extract the table structure from previous step:

    #"Lignes groupées1" = Table.Group(
        #"Valeur remplacée1",
        {"Adresse"},
        {
            {"Nouveau", each Table.RowCount(_), Int64.Type},
            {"Min Date", each List.Min([Date created]), type datetime},
            {"T", each _, type table}
        }
    ),
    #"T développé1" = Table.ExpandTableColumn(
        #"Lignes groupées1", "T", Table.ColumnNames(#"Lignes groupées1"), Table.ColumnNames(#"Lignes groupées1")
    )

Regards,

Xiaoxin Sheng

Hello @Anonymous , your group step works great but not the table expand column. I get an error saying that "Adresse" already exists. It seems with this method that PQ is not able to make the difference between the column that is inside the table and the one already there. It thinks it's the same.

 

Thank you

Hello @Anonymous , after the group step that you suggested, there is a simple solution for the expand all. You need to delete the original column (In this case "Address") before it reappears with the expand step. For the expand step, here's a good tutorial on how to do it.

 

https://goodly.co.in/expand-all-columns-dynamically-power-query/

 

Thank you

Helpful resources

Announcements
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!

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