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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ahobbs_03
Regular Visitor

Extracting Text Before a Delimiter When Having 2 Delimiters

Hi! I am fairly new to Power BI. I have a column that contains a list of URLs. Some URLs have text that I need to remove. The text that I need removed will either start with "#" or "?". I am wanting to get the Clean URL. This was a great resource however, it is only for 1 delimiter. Can someone help me figure out how to add "?" to my code? 

Example of URL structure:

www.urlexample.com/facility/services/#about

www.urlexample.com/facility/?utm_source_utm_campaign

 

 

Clean Entry Page URL = 
LEFT(
    CardiologyPagePerformance[Entry Page URL],
    SEARCH(
        "#",
        CardiologyPagePerformance[Entry Page URL],
        ,
        LEN(CardiologyPagePerformance[Entry Page URL]) +1
    ) -1
)

 

 

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

As argument in Custom Column Dialog:

Splitter.SplitTextByAnyDelimiter({"#","?"})([Column1]){0}

 

Example from Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKi8v1ystykmtSMwtyEnVS87P1U9LTM7MySyp1C9OLSrLTE4t1ldOTMovLVGK1cGv3r60JDe+OL+0KDk1HsRMBqpJzEzPU4qNBQA=", 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}}),
    
    #"Added Custom" =Table.AddColumn(#"Changed Type", "Custom", each 
        Splitter.SplitTextByAnyDelimiter({"#","?"})([Column1]){0}, type text)
in
    #"Added Custom"

 

ronrsnfld_0-1732297554797.png

 

 

View solution in original post

1 REPLY 1
ronrsnfld
Super User
Super User

As argument in Custom Column Dialog:

Splitter.SplitTextByAnyDelimiter({"#","?"})([Column1]){0}

 

Example from Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKi8v1ystykmtSMwtyEnVS87P1U9LTM7MySyp1C9OLSrLTE4t1ldOTMovLVGK1cGv3r60JDe+OL+0KDk1HsRMBqpJzEzPU4qNBQA=", 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}}),
    
    #"Added Custom" =Table.AddColumn(#"Changed Type", "Custom", each 
        Splitter.SplitTextByAnyDelimiter({"#","?"})([Column1]){0}, type text)
in
    #"Added Custom"

 

ronrsnfld_0-1732297554797.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.