Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
73 | |
71 | |
54 | |
38 | |
31 |
User | Count |
---|---|
71 | |
64 | |
60 | |
50 | |
45 |