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
goober04
New Member

first time user power query extracting text from URL into column

hello all,

 

new user. super limited programming knowledge. first time on forums (advice appreciated if going about it wrong)

 

I have a URL query in PowerBI (https://websiteurl/api/thisisthetextiwant/01/moreurltexthere) and I want to bring the specific text highlighed into a column in my query.  the URL is the source for my table, it does not exist in its own table. I want to run future queries and the highlighted text is the only thing which is different and needs its own column. Im just lost on what type of query this would be. THe URL is always the same length and construction so my thought was how can I get the text "23 characters from the left" and until the "/01".

 

Table source:  (https://websiteurl/api/thisisthetextiwant/01/moreurltexthere)

Header 01 from URL jsonHeader 02 from URL jsonHeader 03 from URL jsonCustom Column
datadatadatathisisthetextiwant
datadatadatathisisthetextiwant
11 REPLIES 11
goober04
New Member

Ok. we are getting somewhere but still an error. 

 

goober04_0-1693823785169.png

the URL isnt in the dataset itself, its where the dataset it coming from. Am i missing something....again?

annonymous1999_0-1693824079449.png

@goober04  heres my result

 

So what you are doing I understand. My challenge is I have no existing table with the URL. The URL text I am wanting is my source URL where I am then extracting table data from. The table data itself does not have the URL available (unless theres a way to do that). See attached image of the full URL for my source. From my applied steps, the goal was to extract the URL text and attach it to every record value in the table. Make sense?

 

goober04_0-1693824382174.png

 

annonymous1999_0-1693824079449.png

@goober04  heres my result

 

the name of my column i used was [url] you need to change "url" with your column name containing the url and make sure its case sensitive

what is your url column called?

I called it "database"

 

goober04_0-1693824081869.png

 

 

 

@goober04  i meant which column has the urls you need to extract the tet from?

eliasayyy
Super User
Super User

hello @goober04  in power query go to add columns and choose new custom column 
type in 

 

 

let
    fullURL = [url],  // Get the full URL from the current row
    extractedText = Text.Middle(fullURL, 23, Text.PositionOf(fullURL, "/01") - 23)  // Extract the desired substring
in
    extractedText

 

 




 

annonymous1999_2-1693823018260.png

 

 

goober04_0-1693823461504.png

Appreciate the quick response @eliasayyy . Tried it and this is the result. What am I missing here?

try this 

let
    fullURL = [url],  // Get the full URL from the current row
    extractedText = Text.Middle(fullURL, 23, Text.PositionOf(fullURL, "/01") - 23)  // Extract the desired substring
in
    extractedText

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.