Forum Discussion

Ben_Nash's avatar
Ben_Nash
Frequent Visitor
10 years ago
Solved

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

 

 

  • 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

     

     

     

     

10 Replies

  • Baskar's avatar
    Baskar
    Resident Rockstar

    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

  • MattAllington's avatar
    MattAllington
    Community Champion

    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. 

    • Ben_Nash's avatar
      Ben_Nash
      Frequent Visitor

      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:

       

       

       Thanks 

       

      Ben

      • MattAllington's avatar
        MattAllington
        Community Champion

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