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
Mahamood0218
Helper II
Helper II

Split the columns and apply the sort

Hi Experts ,

i have a two columns(Sub_group_id and Sub_group)

Mahamood0218_0-1652264495571.png

i need to split the Sub_Group data Full-Time/Expert as "Full-Time" and Part-Time/Exempt as "Part-Time" and i have three clomuns data like Contractor ,Project only,Vendar Maintainance i need to show this three data as 

 

Contractor  --- Agency and Contractor

Project only  -- Agency and Contractor

Vendar Maintainance -- Agency and Contractor and finally i need apply sort

finally my output  like as below pic.,

 

Mahamood0218_1-1652265471388.png

 

 

 

 

 

8 REPLIES 8
v-eqin-msft
Community Support
Community Support

Hi @Mahamood0218 ,

 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it.

 

Best Regards,
Eyelyn Qin

@v-eqin-msft i get the below issue when i work on pbi

Mahamood0218_0-1654755654475.png

 

Mahamood0218
Helper II
Helper II

@SanketBhagwat as per my requirement your suggestion is working but here main issue is when split the columns in trasformation editor and when close&save i am getting this below issue

Mahamood0218_0-1652717812917.png

 

Vijay_A_Verma
Super User
Super User

In a custom column named SubGroupDisplay, put following formula (Replace Data will your column name)

 

= [s=Text.Replace(Text.Trim(Text.BeforeDelimiter([Data],"/")),"-"," "),
r=if s<>"Full Time" and s<>"Part Time" then "Agency and Contractors" else s][r]

 

See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcivNydENycxN1ffLz9N1rUjNLShRitWJVnLOzyspSkwuyS8Cc0HqFEDqFPQVXHzAQgGJRSVgragKIHJF+VmpySUK/nk5lWCBsNS8lPwiBd/EzLyS1LzEvGSgulgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Data = _t]),
    #"Added Custom" = Table.AddColumn(Source, "SubGroupDisplay", each [s=Text.Replace(Text.Trim(Text.BeforeDelimiter([Data],"/")),"-"," "),
r=if s<>"Full Time" and s<>"Part Time" then "Agency and Contractors" else s][r])
in
    #"Added Custom"

 

Mahamood0218
Helper II
Helper II

@SanketBhagwat i applied delimiter at column sub group and i get the exact data but when i close and save in Transform edit i am getting issue like below

 

Mahamood0218_0-1652267859077.png

 

Can you share the output you are getting after splitting the column?

SanketBhagwat
Solution Sage
Solution Sage

Hi @Mahamood0218 .
You can split columns using delimeter, in delimeter you can specify as "/".

Refer the below link for more info.
https://docs.microsoft.com/en-us/power-query/split-columns-delimiter


Thanks,
Sanket


If this post helps, then mark it as 'Accept as Answer' and give it a thumbs up.

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