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
UlisesCiccola
Helper I
Helper I

Analyzing Surveys with Power BI

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. 

 recorte Encuesta Pwer BI.PNG

 

Thank you regards

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @UlisesCiccola ,

 

Here I made a sample for your referecen. Firstly, we should fill down the Preguntas column in power query.

 

fill.PNG

 

Then transform and Promoted Headers, after that we can unpivot the three columns to get the new table.

 

3.PNG

 

 

Capture.PNG

 

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

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @UlisesCiccola ,

 

Here I made a sample for your referecen. Firstly, we should fill down the Preguntas column in power query.

 

fill.PNG

 

Then transform and Promoted Headers, after that we can unpivot the three columns to get the new table.

 

3.PNG

 

 

Capture.PNG

 

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

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

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

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

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.