Forum Discussion
Anonymous
1 year agoNot applicable
Pivot or Unpivot?
Hi All, I have in power query the following table Code Grp Name Qtr_Year 400 23 BGT Q1_2025 400 23 BGT Apple Now I want the below output Code Grp Name Qtr_Year Ctgy...
pankajnamekar25
1 year agoSuper User
Hello Anonymous
You can achieve this in Power Query by using Group By and Text.Combine. Here's how:
Steps in Power Query
- Load your data into Power Query.
- Select the "Code" and "Grp" columns, then go to Transform → Group By.
- In the Group By window:
- Group by: Code and Grp
- New Column Name: Merged_Name
- Operation: All Rows
- Click OK → this will create a grouped table.
- Click on the small icon in the grouped column to expand the "Name" and "Qtr_Year" columns.
- Create a custom column using this formula:
powerquery
CopyEdit
Text.Combine([Qtr_Year], " ") & " " & Text.Combine([Name], " ")
This merges the values from both columns into a single row.
- Remove unnecessary columns if needed.
- Click Close & Load to return the transformed data to Excel or Power BI
Thanks,
Pankaj
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.