Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I need to extract some text from within a block of text into some new columns
Here is an exampe of the text. From it I need to create a column containing the leaver name (Daniel) and the date of leaving (11/09/2020). Would I do this using the Search function?
The Leaver Notification for Daniel has been confirmed by HR.
HR014 Details:
Leaver Name:Daniel
Date of Leaving: 11/09/2020
Emails to be forwarded: Yes
Email to forward to: steve
Is access to the user's files to be given? No
If yes, acess to be given to:
Remove person from the system from: 12/09/2020
Cancel phone account: No
If yes, mobile phone number:
For any questions, please email the 'UK HR' mailbox
Solved! Go to Solution.
Hi @Anonymous ,
Check the formula.
name =
var start1 = SEARCH("Leaver Name:",'Table'[Column1])+12
var end1 = SEARCH("Date of Leaving:",'Table'[Column1])-1
var start2 = SEARCH("Date of Leaving:",'Table'[Column1])+16
var end2 = SEARCH("Emails to be forwarded:",'Table'[Column1])-1
return
MID('Table'[Column1],start1,end1-start1)&MID('Table'[Column1],start2,end2-start2)
Best Regards,
Jay
Hi @Anonymous ,
Check the formula.
name =
var start1 = SEARCH("Leaver Name:",'Table'[Column1])+12
var end1 = SEARCH("Date of Leaving:",'Table'[Column1])-1
var start2 = SEARCH("Date of Leaving:",'Table'[Column1])+16
var end2 = SEARCH("Emails to be forwarded:",'Table'[Column1])-1
return
MID('Table'[Column1],start1,end1-start1)&MID('Table'[Column1],start2,end2-start2)
Best Regards,
Jay
Hi @Anonymous
Download this sample file with the following code
Try this in Power Query
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("TY/NTsMwEIRfZdQzUpMICeELBwJqBeohiAMqPTjtpI0Ue4PtBPL2OD9F3Nb+dmZn9vvVpkjSW+QMum68eqXu6bDThirXtmaDXAdCKoyotmeFNF0n9+ssyRI8mVGFICiJSty3dieeFD7oZzai5T+OCm+BPbH10Mcj/aQMF6LzdJ9dkmR3HlXd8Gp5rnvaB+wE2woD/U3ULbIrnWwLGom+LZ0Xi8qJmWz94APN9I6xs7/Yj9oeY7P2IpZjEulsUP+vGCljimXBdqakU3gWB20HfHX0oRYb99qG2hOcq8aLc4n3F2yKecSISvlZHQ6/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each Text.BetweenDelimiters([Column1],"Leaver Name:","Emails to be forwarded")),
#"Split Column by Delimiter" = Table.SplitColumn(#"Added Custom", "Custom", Splitter.SplitTextByDelimiter("Date of Leaving:", QuoteStyle.None), {"Custom.1", "Custom.2"}),
#"Renamed Columns" = Table.RenameColumns(#"Split Column by Delimiter",{{"Custom.1", "Leaver Name"}, {"Custom.2", "Date of Leaving"}})
in
#"Renamed Columns"
Regards
Phil
Proud to be a Super User!
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
74 | |
71 | |
39 | |
27 | |
27 |
User | Count |
---|---|
97 | |
96 | |
58 | |
45 | |
42 |