cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RickL Frequent Visitor
Frequent Visitor

Split several columns at once into rows

I have a dataset with multiple concatenated fields and I need to split them into rows based on the delimiter (some cases a semicolon, others a comma). 

 

Report format (input)

IDAggregated_EthnicityAggregated_Ethnicity_Group
1New Zealand European/PakehaEuropean
2New Zealand European/Pakeha;New Zealand MaoriEuropean; Maori
3British/Irish;New Zealand European/PakehaEuropean
4Indian;New Zealand European/Pakeha;OtherAsian; European; Other

 

Output I want

IDAggregated_EthnicityAggregated_Ethnicity_Group
1New Zealand European/PakehaEuropean
2New Zealand European/PakehaEuropean
2New Zealand MaoriMaori
3British/IrishEuropean
3New Zealand European/PakehaEuropean
4IndianAsian
4New Zealand European/PakehaEuropean
4OtherOther
1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-yuezhe-msft
Moderator

Re: Split several columns at once into rows

@RickL,

Add a cutsom column in your table.

if Text.Contains([Aggregated_Ethnicity], ";")=true and  Text.Contains([Aggregated_Ethnicity_Group], ";")=false then [Aggregated_Ethnicity_Group] &";"&[Aggregated_Ethnicity_Group]else [Aggregated_Ethnicity_Group]

1.PNG

Then duplicate your table, and split columns and merge tables. For more details, please review attached PBIX file.
1.PNG2.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Moderator v-yuezhe-msft
Moderator

Re: Split several columns at once into rows

@RickL,

Add a cutsom column in your table.

if Text.Contains([Aggregated_Ethnicity], ";")=true and  Text.Contains([Aggregated_Ethnicity_Group], ";")=false then [Aggregated_Ethnicity_Group] &";"&[Aggregated_Ethnicity_Group]else [Aggregated_Ethnicity_Group]

1.PNG

Then duplicate your table, and split columns and merge tables. For more details, please review attached PBIX file.
1.PNG2.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

RickL Frequent Visitor
Frequent Visitor

Re: Split several columns at once into rows

Thanks Lydia

Helpful resources

Announcements
October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 361 members 3,374 guests
Please welcome our newest community members: