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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
metcala
Helper III
Helper III

Combine duplicated columns

Hi all

 

I have a fairly unconventional data structure that I am looking to tidy up. In short, there can be an overlap of occupants in roles for training up etc but the data structure stores this as below:

 

Role ID.  Team.  Grade.  Occupant 1 ID.  

Occupant 1

Start Date.  

Occupant 1

End Date.  

Occupant 2 ID.  

Occupant 2

Start Date.  

Occupant 2

End Date.  

101A330011/1/20 30171/3/23 
102A230111/7/22    

 

I am looking to remove the duplicated occupant columns to get the following structure:

 

Role ID.  Team.  Grade.  Occupant ID.  Start Date.  End Date.  
101A330011/1/20 
101A330171/3/23 
102A230111/7/22 

 

Struggling a bit with how I would go about this in Power Query and any help would be really appreciated!

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi

Unpivot, split attribute, Pivot

let
Source = YourSource,
Unpivot = Table.UnpivotOtherColumns(Source, {"Role ID.", "Team.", "Grade."}, "Attribute", "Value"),
Split = Table.SplitColumn(Unpivot, "Attribute", Splitter.SplitTextByPositions({0, 11}, false), {"Attribute.1", "Attribute.2"}),
Pivot = Table.Pivot(Split, List.Distinct(Split[Attribute.2]), "Attribute.2", "Value")
in
Pivot

Stéphane 

View solution in original post

2 REPLIES 2
slorin
Super User
Super User

Hi

Unpivot, split attribute, Pivot

let
Source = YourSource,
Unpivot = Table.UnpivotOtherColumns(Source, {"Role ID.", "Team.", "Grade."}, "Attribute", "Value"),
Split = Table.SplitColumn(Unpivot, "Attribute", Splitter.SplitTextByPositions({0, 11}, false), {"Attribute.1", "Attribute.2"}),
Pivot = Table.Pivot(Split, List.Distinct(Split[Attribute.2]), "Attribute.2", "Value")
in
Pivot

Stéphane 

Thanks Stéphane, worked perfectly!

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors