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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
dgreen1
Frequent Visitor

Power Query text does NOT end with

I'm trying to say as long as text does not end with " 01" or " 02" then do a transformation, otherwise leave it as is but I get an error that I can't use not with text. Is there another way?

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

Here is a sample code that will do a transformation (takes the text before the " " delimiter) for all rows that do not end in " 01" or " 02".
Hope this helps point you in the right direction.

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk7MLchJVTAwVIrVQfCMUHjGKDwTFB5QXywA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Extracted Text Before Delimiter" = Table.TransformColumns(#"Changed Type", {{"Column1", each if not Text.EndsWith(_, " 01") and not Text.EndsWith(_, " 02") then Text.BeforeDelimiter(_, " ") else _, type text}})
in
#"Extracted Text Before Delimiter"




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
ThxAlot
Super User
Super User

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk7MLchJVTAwVIrVQfCMUHjGKDwTFB5QXywA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"NOT Ends With" = Table.TransformColumns(Source, {"Column1", each if not List.Contains({"01","02"}, _, (x,y) => Text.EndsWith(y,x)) then "do sth with " & _ else _, type text})
in
    #"NOT Ends With"

ThxAlot_0-1703138971510.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



jgeddes
Super User
Super User

Here is a sample code that will do a transformation (takes the text before the " " delimiter) for all rows that do not end in " 01" or " 02".
Hope this helps point you in the right direction.

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCk7MLchJVTAwVIrVQfCMUHjGKDwTFB5QXywA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
#"Extracted Text Before Delimiter" = Table.TransformColumns(#"Changed Type", {{"Column1", each if not Text.EndsWith(_, " 01") and not Text.EndsWith(_, " 02") then Text.BeforeDelimiter(_, " ") else _, type text}})
in
#"Extracted Text Before Delimiter"




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.