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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Between Delimiters for various different domain names and domain extensions

I have a plethora of different types of URL's and i would like to extract the domain names only and leave everything else. The problem is when i do a transformation to extract, only 1 start delimiter is available to do multiple URL's? For example: www.powerbi.com extracted is "powerbi" but as soon as a https://www.powerbi.com instance happens it gives an error or extracts improperly? Can i do multiple delimiter conditions to create a column with the domain in text IE; "powerbi"??

8 REPLIES 8
tackytechtom
Super User
Super User

Hi @Anonymous ,

 

How about this:

tomfox_0-1649364292216.png

 

You can find this actions under transform > extract > Text between delimeters:

tomfox_1-1649364363788.png

 

Does this help? 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Anonymous
Not applicable

Thank you very much but not quite. I've tried those methods and it's more intricate then that. I need to be able to set multiple conditons. Some including the above are these URL types: "https://thesouth.com" or "thesouth.com" or "www.thesouth" or "https://www.thesouth.com" or "thesouth.gov" = "thesouth".

I get some results to extract but not all. I need them all if possible?

Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WyigpKSi20tcvyUgtzi8tydBLzs9VitWJVsIQKC8v14MJYgjAVcHMwyoJF0jPL1OKjQUA", 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}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type","https://","",Replacer.ReplaceText,{"Data"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","www.","",Replacer.ReplaceText,{"Data"}),
    #"Extracted Text Before Delimiter" = Table.TransformColumns(#"Replaced Value1", {{"Data", each Text.BeforeDelimiter(_, "."), type text}})
in
    #"Extracted Text Before Delimiter"

 

Anonymous
Not applicable

Thank you very much. But im six weeks in and i tried to replace the source and can't seem to grasp the concept of it?? How would i go about changing it appropriately?? 

To understand the concept, do it manually - Select the column - Right click - Replace values - Put https:// in Value to Find and OK...This will replace https:// with blank.

The generates this statement

#"Replaced Value" = Table.ReplaceValue(#"Changed Type","https://","",Replacer.ReplaceText,{"Data"}),

Anonymous
Not applicable

That is already including in the above test code. What do i remove from my query to add to the above code to extract all of the unique URL's?? Here is my query? What do i remove to add to your code?PBI Source.png

In PQ, please see what is the column name which contains URL- Note it.

Remove all lines starting with #"Removed Columns" in your code.

Copy my code starting with #"Replaced Value" till end and paste in your code.

Now, replace "Data" in my code wherever it appears with the column name which contains URL.

mramstead1
Frequent Visitor

Hello Luis,

 

I was able to split https://www.powerbi.com into three separate columns. Here's what they looked like:

mramstead1_0-1649363793327.png

From my understanding of your post, you would be able to delete columns 1 and 3 after splitting, keeping only "powerbi" in the column.

 

If this is what you are looking for here are the steps I used to do this:

1. Right click column -> Split Column -> By Delimiter

2. "Select or enter delimiter" = Select --Custom--

mramstead1_1-1649363987368.png

Use these setting and hit ok.

 

Hopefully this achieves what you are looking for! 

 

--Michael

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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