cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Expand column containing both text and table types

Hi,

 

I have an XML file where almost all columns contain mostly tables and can be expanded easily in the UI. However some columns contain both text and table types.

An example:

 

Capture.PNG

 

 

 

 

 

 

 

 

 

 

There isn't an "Expand" button in the column header. Is there anyway to expand these columns even though some cells contain text?

 

Thanks,

 

TR

1 ACCEPTED SOLUTION

Accepted Solutions
prateekraina New Contributor
New Contributor

Re: Expand column containing both text and table types

Hi,

 

You can use below code in a step in the Query Editor.

Table.TransformColumns(Source, {{“Column1”, each if Value.Is(_, type table) then _ else #table({“Column1”}, {{_}} ) }} )

 

 

Reference:
https://www.thebiccountant.com/2017/07/25/how-to-expand-a-column-that-cannot-be-expanded-in-power-bi...
Written by @ImkeF

 

Prateek Raina

3 REPLIES 3
prateekraina New Contributor
New Contributor

Re: Expand column containing both text and table types

Hi,

 

You can use below code in a step in the Query Editor.

Table.TransformColumns(Source, {{“Column1”, each if Value.Is(_, type table) then _ else #table({“Column1”}, {{_}} ) }} )

 

 

Reference:
https://www.thebiccountant.com/2017/07/25/how-to-expand-a-column-that-cannot-be-expanded-in-power-bi...
Written by @ImkeF

 

Prateek Raina

Super User
Super User

Re: Expand column containing both text and table types

You have to transform the column before expanding: https://www.thebiccountant.com/2017/07/25/how-to-expand-a-column-that-cannot-be-expanded-in-power-bi...

 

Table.TransformColumns(Source, {{“Scope Description”, each if Value.Is(_, type table) then _ else #table({"Column1"}, {{_}} ) }} )

 

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

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




Anonymous
Not applicable

Re: Expand column containing both text and table types

Thanks - worked like a charm!