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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
HarryT
Helper I
Helper I

How to rearrange the columns in a table to be on the left?

I have a straight table with two columns for now that I want to be at the left side instead of the top.

How can I do this?  

 

Before:

DateHomeruns
2022-10-051
2022-10-063

 

 

After:

Date2022-10-052022-10-06
Homeruns13
4 REPLIES 4
Arul
Super User
Super User

@HarryT ,

try this,

step 1 : Go to Power Query Editor, then demote the headers.

step 2 : Transpose the table.

you will get the result like the below and you can rename the columns based on your requirement (OR) If you want to promote the headers you can do that as well.
attached the M code for the same,

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtI1NNA1MFXSUTJUitVBEjIDChkrxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Homeruns = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Homeruns", Int64.Type}}),
    #"Demoted Headers" = Table.DemoteHeaders(#"Changed Type"),
    #"Changed Type1" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type any}, {"Column2", type any}}),
    #"Transposed Table" = Table.Transpose(#"Changed Type1")
in
    #"Transposed Table"

 

 

Arul_0-1665070752581.png

Thanks,

 





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

Proud to be a Super User!


LinkedIn


Are you saying to transpose the whole table?  There is like 50 columns and I only want to show 2 of them in a table view this way.

@HarryT , you mean that you want to show this in table visual? or data view?

Thanks,





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

Proud to be a Super User!


LinkedIn


Anonymous
Not applicable

Hi,

 

I would transpose your table in Power Query

 

helpme_0-1665069896384.png

 

which would result in the following M code:

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WckksSVXSUfLIz00tKs0rVorViVYyMjAy0jU00DUwBcoYogqZAYWMlWJjAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t]),
    #"Transposed Table" = Table.Transpose(Source)
in
    #"Transposed Table"

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.