Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Pivot Text Columns by initial row

I'd like to pivot multiple text rows into one with a comma based on an employee column. Does anyone know how to do this?

 

I have the following table:

 

Employee ID

Employee Degree

 

It looks like this:

Emp ID   |   Degree

251        |   Master of Science

251        |   Bachelor of Arts

352        |   Bachelor of Sciences

 

I'd like it to look like:

 

Emp ID      Degree

251       |   Master of Science, Bachelor of Arts

352       |   Bachelor of Sciences

1 ACCEPTED SOLUTION
Anonymous
Not applicable

In Power Query:

  1. Group the table by Emp ID and want all Rows:
  2. Groupby.png
  3. Add a custom column with this code:
List.Accumulate(
[Count][Degree],
"",
(state,current)=> (state &", "& current)
)
  1. It will produce a column like this:
  2. List Accum Column.png
  3. Remove the [Count] column
  4. Split the new Degree column by a comma, left most delimiter ( it will get rid of that inital comma)
  5. Remove the blank column
  6. Trim the degree column

FInal Table:

Final Table.png

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

In Power Query:

  1. Group the table by Emp ID and want all Rows:
  2. Groupby.png
  3. Add a custom column with this code:
List.Accumulate(
[Count][Degree],
"",
(state,current)=> (state &", "& current)
)
  1. It will produce a column like this:
  2. List Accum Column.png
  3. Remove the [Count] column
  4. Split the new Degree column by a comma, left most delimiter ( it will get rid of that inital comma)
  5. Remove the blank column
  6. Trim the degree column

FInal Table:

Final Table.png

Anonymous
Not applicable

This worked perfectly! Thank you!

Anonymous
Not applicable

Awesome! Glad it worked 🙂

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.