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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

delete everything before the last transcription of a string

Hello,


Data = "aaaa eeee rrrr ttttt yyyy uuuu aaaa ffff hhhh aaaa cccc"


I'm trying to delete everything before the last "aaaa" on each cell.


Output "line 4" should be "aaaa cccc"

Output "line 5" should be "aaaa"

 

cher90_0-1662648204450.png

 

Thanks!

Amine

 

1 ACCEPTED SOLUTION
AntonioM
Solution Sage
Solution Sage

Hi @Anonymous ,

 

You could try

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSgQChVQgUCgCAoUSEFCoBAKFUiBQAEunAYFCBhBAuMlAoBSrE60E1gYSUoqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [data = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"data", type text}}),
    #"Extracted Text After Delimiter" = Table.TransformColumns(#"Changed Type", {{"data", each Text.AfterDelimiter(_, "aaaa", {0, RelativePosition.FromEnd}), type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Extracted Text After Delimiter",each [data], each "aaaa " & [data] ,Replacer.ReplaceValue,{"data"})
in
    #"Replaced Value"

 

 

Two steps here. First extract everything after the first "aaaa" from the end and then add "aaaa " back to the front.

 

AntonioM_0-1662649396757.png

AntonioM_1-1662649403706.png

AntonioM_2-1662649409309.png

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Worked thanks!

AntonioM
Solution Sage
Solution Sage

Hi @Anonymous ,

 

You could try

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSgQChVQgUCgCAoUSEFCoBAKFUiBQAEunAYFCBhBAuMlAoBSrE60E1gYSUoqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [data = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"data", type text}}),
    #"Extracted Text After Delimiter" = Table.TransformColumns(#"Changed Type", {{"data", each Text.AfterDelimiter(_, "aaaa", {0, RelativePosition.FromEnd}), type text}}),
    #"Replaced Value" = Table.ReplaceValue(#"Extracted Text After Delimiter",each [data], each "aaaa " & [data] ,Replacer.ReplaceValue,{"data"})
in
    #"Replaced Value"

 

 

Two steps here. First extract everything after the first "aaaa" from the end and then add "aaaa " back to the front.

 

AntonioM_0-1662649396757.png

AntonioM_1-1662649403706.png

AntonioM_2-1662649409309.png

 

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors