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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
D3K
Advocate II
Advocate II

How to open value "Table" in column in PowerQuery

Hey everyone!

I suppose it's a very simple case, but I really have no idea, how to solve it.

I've got a column in PowerQuery, which contains value/link "Table". If I click and open it - there is only 1 value.

How to "open" this column?

Please, check the picture below.

Thanks a lot for your help!

2020-02-09_16-18-30.png

 

2 ACCEPTED SOLUTIONS
smpa01
Super User
Super User

@D3K  in your case you can't expand those tables because not all the rows in that column has table value. Unless all the records are table in that column you can't apply Table.ExpandTableColumn.

 

But there is a workarounnd. Let's suppose your source data is following

TemplateDescription1Description2
Q1Raushanabc
Q1Raushandef
Q1Raushanghi
Q1Raushanjkl
Q2SanjayAB
Q2SanjayCD
Q2SanjayEF

 

And you find yourself in this step

 

fake.PNG

 

You can do this

 

/// you need to customize from here on to fit your scenario 
 #"Added Custom1" = Table.AddColumn(Custom1, "Custom", each Value.Type([Column1])),
    Custom2 = Table.AddColumn(#"Added Custom1", "Custom.1", each Type.Is([Custom],Table.Type)),
    #"Added Custom3" = Table.AddColumn(Custom2, "Custom.2", each if [Custom.1] =false then Table.RemoveColumns(Table.Group(#table({"Description1", "Description2"}, {{"",""}}), {"Description1"}, {{"ad", each _, type table [Description1=text, Description2=text]}}),{"Description1"}) else [Column1]),
    Custom4 = Table.AddColumn(Custom2, "Custom.2", each if [Custom.1] =false then #table({"Description1", "Description2"}, {{"",""}}) else [Column1]),
    #"Added Custom2" = Table.AddColumn(Custom4, "Custom.3", each if [Custom.1] = false then  [Column1] else " "),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom2",{"Custom", "Custom.1"}),
    #"Expanded Custom.2" = Table.ExpandTableColumn(#"Removed Columns1", "Custom.2", {"Description1", "Description2"}, {"Description1", "Description2"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Custom.2",{"Column1", "Custom.3", "Description1", "Description2"}),
    #"Removed Columns2" = Table.RemoveColumns(#"Reordered Columns",{"Column1"})
in
    #"Removed Columns2"

 

 

to come to this

 

fake2.PNG

 

the full code is here

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCknNLchJLElV0lFySS1OLsosKMnMzzNE5RopxepEKwWCRIMSS4szEvOArMSkZGzCKalp2ITTMzKxCWdl50CEjYCc4MS8rMRKIMPRCYugswsWQVc3pdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Template", type text}, {"Description1", type text}, {"Description2", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type1", {"Template"}, {{"ad", each _, type table [Template=text, Description1=text, Description2=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each let
X = [ad],
Y = Table.RemoveColumns(X,{"Template"})
in Y),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"ad"}),
    #"Transposed Table" = Table.Transpose(#"Removed Columns"),
    X = Table.RemoveColumns(#"Transposed Table",{"Column2"}),
    Y = Table.RemoveColumns(#"Transposed Table",{"Column1"}),
    Z = Table.RenameColumns(Y,{{"Column2", "Column1"}}),
    Custom1 = X&Z,
    #"Added Custom1" = Table.AddColumn(Custom1, "Custom", each Value.Type([Column1])),
    Custom2 = Table.AddColumn(#"Added Custom1", "Custom.1", each Type.Is([Custom],Table.Type)),
    #"Added Custom3" = Table.AddColumn(Custom2, "Custom.2", each if [Custom.1] =false then Table.RemoveColumns(Table.Group(#table({"Description1", "Description2"}, {{"",""}}), {"Description1"}, {{"ad", each _, type table [Description1=text, Description2=text]}}),{"Description1"}) else [Column1]),
    Custom4 = Table.AddColumn(Custom2, "Custom.2", each if [Custom.1] =false then #table({"Description1", "Description2"}, {{"",""}}) else [Column1]),
    #"Added Custom2" = Table.AddColumn(Custom4, "Custom.3", each if [Custom.1] = false then  [Column1] else " "),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom2",{"Custom", "Custom.1"}),
    #"Expanded Custom.2" = Table.ExpandTableColumn(#"Removed Columns1", "Custom.2", {"Description1", "Description2"}, {"Description1", "Description2"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Custom.2",{"Column1", "Custom.3", "Description1", "Description2"}),
    #"Removed Columns2" = Table.RemoveColumns(#"Reordered Columns",{"Column1"})
in
    #"Removed Columns2"

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

v-lili6-msft
Community Support
Community Support

hi  @D3K 

You may refer to this similar post too:

https://community.powerbi.com/t5/Desktop/Expand-value-from-table/td-p/214838

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
D3K
Advocate II
Advocate II

@v-lili6-msft @smpa01 

 

Thanks a lot!  It works, in a both ways.

Sorry for the late answer - was on a vacation

v-lili6-msft
Community Support
Community Support

hi  @D3K 

You may refer to this similar post too:

https://community.powerbi.com/t5/Desktop/Expand-value-from-table/td-p/214838

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
smpa01
Super User
Super User

@D3K  in your case you can't expand those tables because not all the rows in that column has table value. Unless all the records are table in that column you can't apply Table.ExpandTableColumn.

 

But there is a workarounnd. Let's suppose your source data is following

TemplateDescription1Description2
Q1Raushanabc
Q1Raushandef
Q1Raushanghi
Q1Raushanjkl
Q2SanjayAB
Q2SanjayCD
Q2SanjayEF

 

And you find yourself in this step

 

fake.PNG

 

You can do this

 

/// you need to customize from here on to fit your scenario 
 #"Added Custom1" = Table.AddColumn(Custom1, "Custom", each Value.Type([Column1])),
    Custom2 = Table.AddColumn(#"Added Custom1", "Custom.1", each Type.Is([Custom],Table.Type)),
    #"Added Custom3" = Table.AddColumn(Custom2, "Custom.2", each if [Custom.1] =false then Table.RemoveColumns(Table.Group(#table({"Description1", "Description2"}, {{"",""}}), {"Description1"}, {{"ad", each _, type table [Description1=text, Description2=text]}}),{"Description1"}) else [Column1]),
    Custom4 = Table.AddColumn(Custom2, "Custom.2", each if [Custom.1] =false then #table({"Description1", "Description2"}, {{"",""}}) else [Column1]),
    #"Added Custom2" = Table.AddColumn(Custom4, "Custom.3", each if [Custom.1] = false then  [Column1] else " "),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom2",{"Custom", "Custom.1"}),
    #"Expanded Custom.2" = Table.ExpandTableColumn(#"Removed Columns1", "Custom.2", {"Description1", "Description2"}, {"Description1", "Description2"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Custom.2",{"Column1", "Custom.3", "Description1", "Description2"}),
    #"Removed Columns2" = Table.RemoveColumns(#"Reordered Columns",{"Column1"})
in
    #"Removed Columns2"

 

 

to come to this

 

fake2.PNG

 

the full code is here

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCknNLchJLElV0lFySS1OLsosKMnMzzNE5RopxepEKwWCRIMSS4szEvOArMSkZGzCKalp2ITTMzKxCWdl50CEjYCc4MS8rMRKIMPRCYugswsWQVc3pdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Template", type text}, {"Description1", type text}, {"Description2", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type1", {"Template"}, {{"ad", each _, type table [Template=text, Description1=text, Description2=text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each let
X = [ad],
Y = Table.RemoveColumns(X,{"Template"})
in Y),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"ad"}),
    #"Transposed Table" = Table.Transpose(#"Removed Columns"),
    X = Table.RemoveColumns(#"Transposed Table",{"Column2"}),
    Y = Table.RemoveColumns(#"Transposed Table",{"Column1"}),
    Z = Table.RenameColumns(Y,{{"Column2", "Column1"}}),
    Custom1 = X&Z,
    #"Added Custom1" = Table.AddColumn(Custom1, "Custom", each Value.Type([Column1])),
    Custom2 = Table.AddColumn(#"Added Custom1", "Custom.1", each Type.Is([Custom],Table.Type)),
    #"Added Custom3" = Table.AddColumn(Custom2, "Custom.2", each if [Custom.1] =false then Table.RemoveColumns(Table.Group(#table({"Description1", "Description2"}, {{"",""}}), {"Description1"}, {{"ad", each _, type table [Description1=text, Description2=text]}}),{"Description1"}) else [Column1]),
    Custom4 = Table.AddColumn(Custom2, "Custom.2", each if [Custom.1] =false then #table({"Description1", "Description2"}, {{"",""}}) else [Column1]),
    #"Added Custom2" = Table.AddColumn(Custom4, "Custom.3", each if [Custom.1] = false then  [Column1] else " "),
    #"Removed Columns1" = Table.RemoveColumns(#"Added Custom2",{"Custom", "Custom.1"}),
    #"Expanded Custom.2" = Table.ExpandTableColumn(#"Removed Columns1", "Custom.2", {"Description1", "Description2"}, {"Description1", "Description2"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded Custom.2",{"Column1", "Custom.3", "Description1", "Description2"}),
    #"Removed Columns2" = Table.RemoveColumns(#"Reordered Columns",{"Column1"})
in
    #"Removed Columns2"

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.