Forum Discussion
Mahamood0218
Helper II
4 years agoSplit the columns and apply the sort
Hi Experts , i have a two columns(Sub_group_id and Sub_group) 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 d...
Vijay_A_Verma
Most Valuable Professional
4 years agoIn 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"