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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
JustDavid
Helper IV
Helper IV

Table.ExpandColumnTable inside Records

PQ and M Gurus,

 

I'm trying to know if 'Added Custom' columns each individual steps AND finally expand the columns can be done in 1 step.

 

For example, below is my screenshot where I try to filter before I expand on each step, which is my desired result.

 

Before ExpansionBefore Expansion

 

Each Applied Steps After Expand Columns.png

Each Applied Steps M Code.png

 

However, when I try to combine the last 3 steps into 1, it gave me an error. Specifically the last step where I wasn't able to expand.

 

Am wondering if it's doable. If it is, how?

 

Below are my code

 

=[
  getBinaryContent = Excel.Workbook([Content], true),
  getDesiredSheet = Table.SelectRows
              (getBinaryContent, each [Name] = "Sheet1"),
  ExpandToData = Table.ExpandTableColumn(getDesiredSheet, "getDesiredSheet", {"Data"}, {"Data"})
]

 

 

Thank you!

3 REPLIES 3
Anonymous
Not applicable

Hi @JustDavid ,

 

Please try:

#"Combined Step" = Table.ExpandTableColumn(
    Table.AddColumn(
        Table.AddColumn(#"FilterTo'OpenItemsReport.xlsx'", "getBinaryContent", each Excel.Workbook([Content], true)),
        "getDesiredSheets", each Table.SelectRows([getBinaryContent], each [Name]="Sheet1")
    ),
    "getDesiredSheets", {"Data"}, {"Data"}
)

 Agree with lbendlin that merging multiple steps should be avoided as much as possible, it makes the query less intuitive and harder to check for errors.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Omid_Motamedise
Super User
Super User

There are Issue on your formula for expanding related to argument 2, 3 and 4.

 

in the second argument you sould mention the name of column including table which is column "Data" so replace "getDesiredSheet" with "Data" in the second arguemt.

THe third argument is alist including the column names that you will see after expanding, so replace the third argument with list of column names in the tables. and also remove the last argument.


If my answer helped solve your issue, please consider marking it as the accepted solution.
lbendlin
Super User
Super User

Define what you mean by "one step"

 

=  Table.ExpandTableColumn(Table.SelectRows(Excel.Workbook([Content], true), each [Name] = "Sheet1"), "getDesiredSheet", {"Data"}, {"Data"})

 

is not better than what you did before, in fact it is harder to maintain.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.