Forum Discussion
PhilDo
5 years agoNew Member
Create Column headings from rows
Hey All, I have been pulling my hair out as I can not work out the best way to convert column values into row headings. I have the following table 'CW Results' with the following Name Ques...
amitchandak
Super User
5 years agoPhilDo , I have an unpivoted Question with the result. And the change code List.MAX
Full code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCkgtKs7PU3BU0lEyBGIIHauDImEExE7YJAyhEkbYdDijSzjhssMJSQeGBFY7nJBcBZSIBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, QuestionNumber = _t, Result = _t, Test = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"QuestionNumber", Int64.Type}, {"Result", type text}, {"Test", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Changed Type", {{"QuestionNumber", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Changed Type", {{"QuestionNumber", type text}}, "en-US")[QuestionNumber]), "QuestionNumber", "Result", List.Max)
in
#"Pivoted Column"
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Changed Type", {{"QuestionNumber", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Changed Type", {{"QuestionNumber", type text}}, "en-US")[QuestionNumber]), "QuestionNumber", "Result", List.Max)
This was List.Count, I made it max
Find the file after Signature. See if this can help