cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
navedkhan Helper I
Helper I

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

Accepted Solutions
jared_farber Resolver III
Resolver III

Re: Urgently needs help in "Transposing Columns to rows"

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
jared_farber Resolver III
Resolver III

Re: Urgently needs help in "Transposing Columns to rows"

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

mussaenda Solution Sage
Solution Sage

Re: Urgently needs help in "Transposing Columns to rows"

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

 

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors