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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
navedkhan
Helper III
Helper III

Urgently needs help in "Transposing Columns to rows"

Hi Guys - i am in URGENT need to do the following;

Capture.PNG

Requirement: move columns (measure-2 & comments) as shown above to append beneath a given column [measure-1 & comments] and fill dates for the said no. of entries being added (reason being both columns contain same information) and hence need to be clubbed in one.

 

Any help anyone please?

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello-

 

  One option is to duplicate your table.  In one table, remove all but date, measure-1, and comments-1 (renamed to comments-1).

In the other remove all but date, measure-2 and comments-2(renamed comments-2).

 

After this, rename: measure-1 to measure and measure-2 to measure.  Rename comments-1 to comments and comments-2 to comments.

 

Select Append queries.  They should append as 3 columns: date, measure, and comments.

 

Jared

View solution in original post

2 REPLIES 2
mussaenda
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjLQN7DUNzIwtFTSUXLMKchIBNLJKcUpSNzU8tTyIqVYHTTVTqklEMVp6UDKPTE3F8RNLE5MSUvFVA2TTytOASpBaC9KTS8qSwbah6EDgqIgyrLSM9KUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t, #"measure-1" = _t, #"comments-1" = _t, #"measure-2" = _t, #"comments-2" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"measure-1", type text}, {"comments-1", type text}, {"measure-2", type text}, {"comments-2", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"measure-1", "comments-1"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"measure-2", "measure"}, {"comments-2", "comments"}})
in
    #"Renamed Columns"
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjLQN7DUNzIwtFTSUXLMKchIBNLJKcUpSNzU8tTyIqVYHTTVTqklEMVp6UDKPTE3F8RNLE5MSUvFVA2TTytOASpBaC9KTS8qSwbah6EDgqIgyrLSM9KUYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [date = _t, #"measure-1" = _t, #"comments-1" = _t, #"measure-2" = _t, #"comments-2" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"date", type date}, {"measure-1", type text}, {"comments-1", type text}, {"measure-2", type text}, {"comments-2", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"measure-2", "comments-2"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"measure-1", "measure"}, {"comments-1", "comments"}}),
    #"Appended Query" = Table.Combine({#"Renamed Columns", #"Table (3)"})
in
    #"Appended Query"

2019_09_28_16_28_51_Untitled_Power_Query_Editor.png

 

Anonymous
Not applicable

Hello-

 

  One option is to duplicate your table.  In one table, remove all but date, measure-1, and comments-1 (renamed to comments-1).

In the other remove all but date, measure-2 and comments-2(renamed comments-2).

 

After this, rename: measure-1 to measure and measure-2 to measure.  Rename comments-1 to comments and comments-2 to comments.

 

Select Append queries.  They should append as 3 columns: date, measure, and comments.

 

Jared

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors