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.
Hi everybody,
I need to analyze a customer satisfaction survey with Power BI and I am having problems to build the visualizations. If it is necessary to unpivot a column, I would not know in what way in this case.
I pass the image to you.
Thank you regards
Solved! Go to Solution.
Hi @UlisesCiccola ,
Here I made a sample for your referecen. Firstly, we should fill down the Preguntas column in power query.
Then transform and Promoted Headers, after that we can unpivot the three columns to get the new table.
M code for youre reference.
let Source = Excel.Workbook(File.Contents("x:\xxxx\xxxxx\Book2.xlsx"), null, true), Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data], #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Pre", type text}, {"column1", type any}, {"column2", type any}, {"column3", type any}}), #"Filled Down" = Table.FillDown(#"Changed Type",{"Pre"}), #"Transposed Table" = Table.Transpose(#"Filled Down"), #"Promoted Headers1" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]), #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers1",{{"a", type text}, {"a_1", Int64.Type}, {"a_2", type number}, {"b", type text}, {"b_3", Int64.Type}, {"b_4", Int64.Type}, {"c", type text}, {"c_5", type number}, {"c_6", Int64.Type}}), #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type1", {"a_1", "a_2", "b_3", "b_4", "c_5", "c_6"}, "Attribute", "Value") in #"Unpivoted Columns"
If it doesn't meet your requirement, kindly share your sample data and excepted result to me.
Regards,
Frank
Hi @UlisesCiccola ,
Here I made a sample for your referecen. Firstly, we should fill down the Preguntas column in power query.
Then transform and Promoted Headers, after that we can unpivot the three columns to get the new table.
M code for youre reference.
let Source = Excel.Workbook(File.Contents("x:\xxxx\xxxxx\Book2.xlsx"), null, true), Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data], #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Pre", type text}, {"column1", type any}, {"column2", type any}, {"column3", type any}}), #"Filled Down" = Table.FillDown(#"Changed Type",{"Pre"}), #"Transposed Table" = Table.Transpose(#"Filled Down"), #"Promoted Headers1" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]), #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers1",{{"a", type text}, {"a_1", Int64.Type}, {"a_2", type number}, {"b", type text}, {"b_3", Int64.Type}, {"b_4", Int64.Type}, {"c", type text}, {"c_5", type number}, {"c_6", Int64.Type}}), #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type1", {"a_1", "a_2", "b_3", "b_4", "c_5", "c_6"}, "Attribute", "Value") in #"Unpivoted Columns"
If it doesn't meet your requirement, kindly share your sample data and excepted result to me.
Regards,
Frank
Hi @UlisesCiccola ,
Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.
Regards,
Frank
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |