cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ben_Nash Frequent Visitor
Frequent Visitor

Extract url from text in DAX

Hi everyone

 

I'm trying to extract urls from twitter messages and placing in another column using DAX. I've been using this formula in excel to extract and it works fine:

 

=MID(A1,FIND("http",A1),IFERROR(FIND(" ",A1,FIND("http",A1))-1,LEN(A1))-FIND("http",A1)+1)

 

However I'm strugging to replicate/see how to do this in DAX. Any help greatly appreciated!

 

Thanks

 

Ben

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ben_Nash Frequent Visitor
Frequent Visitor

Re: Extract url from text in DAX

Hi Matt and Baskar - I've followed your suggestion Matt and sorted the problem starting from Query Editor>Transform>Split Column>By Delimiter>Custom>"https".

 

Thanks again!

 

Cheers

 

Ben

 

 

 

 

View solution in original post

10 REPLIES 10
Baskar Super Contributor
Super Contributor

Re: Extract url from text in DAX

Hey pls give an a example . like screen short what u have and what u excatly want ..

 

 

like this, This will help me to solve ur prob

Highlighted
Super User
Super User

Re: Extract url from text in DAX

I agree, you need to post an example. But I also think this is a task for data shaping in power query (get data) and not DAX. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Ben_Nash Frequent Visitor
Frequent Visitor

Re: Extract url from text in DAX

Hi

 

Thanks for getting back to me and good point on power query.

 

Screen grab of examples below - as you can see the urls aren't always in the same spot:

 

url examples.JPG

 

 Thanks 

 

Ben

Super User
Super User

Re: Extract url from text in DAX

How about using power query to split column on colon :  then rebuild the URL http:// from there



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Ben_Nash Frequent Visitor
Frequent Visitor

Re: Extract url from text in DAX

Hi Matt

 

Thanks for this - will do. Apologies for my ignorance but is there anyway I can bring across to power query the actual excel formula I have?

 

Regards

 

Ben

 

Super User
Super User

Re: Extract url from text in DAX

No way unfortunately. But using the power query UZi is much easier than writing Excel formulas. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Ben_Nash Frequent Visitor
Frequent Visitor

Re: Extract url from text in DAX

Thanks Matt - I'll give it a go in Power Query

 

Regards

 

Ben

Baskar Super Contributor
Super Contributor

Re: Extract url from text in DAX

Hey Ben ,

 

Do u want like this ?

1.PNG

Ben_Nash Frequent Visitor
Frequent Visitor

Re: Extract url from text in DAX

Hi

 

I'm giving the Power Query option a go but your screen shot look good - basically where ever there is a url it gets taken out and put in another column (s).

 

Thanks

 

Ben

 

 

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 56 members 1,249 guests
Please welcome our newest community members: