Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
troyphillips
Frequent Visitor

Split column by delimeter and return column with latest date

Hello,

 

I have a user submitted text field in SharePoint, called Notes, in my dataset, and I am looking to always return the latest note in any row. The Notes field is always split by a semicolon ";" delimeter, and each note always starts off with the date in format MM/DD/YYYY.

 

/********************************************************/
Example:

Report NameNotesLatest Note
Revenue by Customer

08/01/2023 - Added ITEM_ID to invoice fact table;

08/21/2023 - Sign off and validation from user;

08/21/2023 - Sign off and validation from user

Top 10 Items Sold08/14/2023 - Kick off planning  meeting;08/14/2023 - Kick off planning  meeting

/********************************************************/

 

Is this acheivable in Power Query? And it is possible for this to be scalable in the event that there are, say, 100 notes for one record? 

Will be happy to provide more info as needed! 

3 REPLIES 3
troyphillips
Frequent Visitor

Hi @jbwtp , I'm not able to get that to work by adding it in as a customer step in Power Query. Mayube worth mentioning that my "Report Name" field is actually called "Title" in my dataset, would this effect the code you posted? Thanks for the help so far!

Hi @troyphillips,

 

The line that you need is this one:

,
#"Added Custom" = Table.AddColumn(PlacePreviousStepNameHere, "Automated", each List.Last(Text.Split([Notes], "
")))
in
    #"Added Custom"

Replace the closing "in YourLastStep" in your code with the above and change the PlaceYourPreviousStep tag to the actual name of the previous step and [Notes] to what is your actual field name for notes.

 

Cheers,

John

jbwtp
Memorable Member
Memorable Member

Hi @troyphillips, This is doable (depending on the formatting of the Notes field). In the most simplist way it can be done like this:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lY07DoJAFEW3cjO1ho8WJlRGLYixETokZmAeZOLwhsBA4m5ciyuTSLSnu8U552aZuNJIPBCKJw5D72xDnVgJf+f5gRf64QZr7JUihTg9Xe7xEc5C82h1Sahk6eBkYSi68aSEfyXRNcNWFSQrjNJoJZ22jKqzDYaeumg+WWCIfJWJ1LYIfMSOmh6JNWrOBNtf5qzLxzfTGsmsuX6/0BC5aUULWJHnHw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Report Name" = _t, Notes = _t, #"Latest Note" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Report Name", type text}, {"Notes", type text}, {"Latest Note", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Automated", each List.Last(Text.Split([Notes], "
")))
in
    #"Added Custom"

Cheers,

JB

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.