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
apaulso9
Resolver I
Resolver I

Reorder column values

I have a two column table. One of the columns has Employee Id and the other has a list of all the benefits that the employee holds. I want to split by delimiter, a comma, but have the columns sort by the benefit type as well. Here is what the data looks like

Employee IDBenefits
01Benefit 1/Family Plan, Benefit 2/Employee Plan,....,....,...,Benefit 7
02Benefit 1/Employee Plan, Benefit 3, Benefit 7

 

When I seperate by delimeter I get

Employee IDBenefitsBenefits_1Benefits_2Benefits_3
01Benefit 1/Family PlanBenefit 2/Employee Plan......
02Benefit 1/Employee PlanBenefit 3Benefit 7 

 

I would like to end with this table:

Employee IDBenefitsBenefits_1Benefits_2Benefits_3
01Benefit 1/Family PlanBenefit 2/Employee Plan......
02Benefit 1/Employee Plan Benefit 3 

 

This way all of the smae type plans are in one column together and a blank field shows up if that employee does not have that plan.

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

I made a simplified dataset.

jgeddes_0-1685039756010.png

First, split the Benefits column by comma delimiter into rows

jgeddes_1-1685039872143.png

Split the resulting Benefits column into columns by forward slash delimiter to get...

jgeddes_2-1685039959219.png

I trimmed Benefits.1 and also replaced the null values in Benefits.2 with 'Has'

Then Pivot Column Benefits.1 using values from Benefits.2 without aggregating

jgeddes_3-1685040059149.png

To end up with...

jgeddes_4-1685040080471.png

Hope this gets you pointed in the right direction.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
jgeddes
Super User
Super User

I made a simplified dataset.

jgeddes_0-1685039756010.png

First, split the Benefits column by comma delimiter into rows

jgeddes_1-1685039872143.png

Split the resulting Benefits column into columns by forward slash delimiter to get...

jgeddes_2-1685039959219.png

I trimmed Benefits.1 and also replaced the null values in Benefits.2 with 'Has'

Then Pivot Column Benefits.1 using values from Benefits.2 without aggregating

jgeddes_3-1685040059149.png

To end up with...

jgeddes_4-1685040080471.png

Hope this gets you pointed in the right direction.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.

Top Solution Authors
Top Kudoed Authors