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

Need help on power query

Hi All,

 

i am having data as below in single row for multiple questions:

 

Column1.q1.questionColumn1.q1.optionsColumn1.q1.answerColumn1.q2.questionColumn1.q2.optionsColumn1.q2.answerand so on…
5 + 7 = ?10,11,12,131212 - 8 = ?1,2,3,44and so on…

 

i want to transform it as below in power query:

 

QuestionOptionsAnswer
5 + 7 = ?10,11,12,1312
12 - 8 = ?1,2,3,44
12 / 4 = ?1,2,3,43

 

is there any way we can do this in power query?

 

Regards,

VIshal.

 

2 ACCEPTED SOLUTIONS
drewlewis15
Solution Specialist
Solution Specialist

First, select all columns and choose to "Unpivot Columns" (found on the Transform tab).  This will unpivot your table to look like this:

1.png

 

From here, split your Attribute column by delimiter (.) to get the question number and the category into separate columns (you can then simply delete the column that references "Column1" in all rows.  Should end up looking like this:

2.png

 

Finally, select your "Attribute.3" column (or whatever the column name ends up being for your categories: question, options, answer) and choose to Pivot the table by the "Value" column along with choosing not to aggregate.  See screenshot below:

3.png

 

This should give you your desired result:

4.png

View solution in original post

@drewlewis15 perfect!!!! 🙂

looks great.... Thanks a ton... (y).

View solution in original post

2 REPLIES 2
drewlewis15
Solution Specialist
Solution Specialist

First, select all columns and choose to "Unpivot Columns" (found on the Transform tab).  This will unpivot your table to look like this:

1.png

 

From here, split your Attribute column by delimiter (.) to get the question number and the category into separate columns (you can then simply delete the column that references "Column1" in all rows.  Should end up looking like this:

2.png

 

Finally, select your "Attribute.3" column (or whatever the column name ends up being for your categories: question, options, answer) and choose to Pivot the table by the "Value" column along with choosing not to aggregate.  See screenshot below:

3.png

 

This should give you your desired result:

4.png

@drewlewis15 perfect!!!! 🙂

looks great.... Thanks a ton... (y).

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.