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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
harsha449
Frequent Visitor

PATHITEM function to extract string from the URL

Hi,

 

I'm trying to extract string from the URL using PATHITEM function, it is working fine for DAX when the data is in excel.

 

Now I'm connect to direct query, i need to use DAX formula compatibilty in DirectQuery mode.

 

https://docs.microsoft.com/en-us/sql/analysis-services/tabular-models/dax-formula-compatibility-in-d...

 

Example:

 

URL: /country/english/pages/careers/article

 

I want to extract "careers" in new column.

 

DAX formula is working fine: PATHITEM(SUBSTITUTE(COLUMN,"/","|"),5)

 

Could you please help me with the function to do the same for direct query

 

Thanks

7 REPLIES 7
v-chuncz-msft
Community Support
Community Support

@harsha449,

 

To ensure that queries sent to the underlying data source have acceptable performance, limitations are imposed on measures by default. Advanced users can choose to bypass this limitation by selecting File > Options and settings > Options and then DirectQuery, then selecting the option Allow unrestricted measures in DirectQuery mode.

https://docs.microsoft.com/en-us/power-bi/desktop-use-directquery#limitations-of-directquery

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

i have turned on that option, it is still not working.

 

I have tried MID and SEARCH functions, I'm getting error message "Search" and "Find" are not allowed as part of calculated column DAX.

 

As per the link below: we need to use 4 argumnet instead of 2 argument.

 

http://community.powerbi.com/t5/Desktop/FIND-SEARCH-in-direct-query-mode/td-p/198993

 

I'm trying that option but still not luck.

@harsha449,

 

The nested FIND Function seems to work for me.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Sam for looking into it.

 

=MID(H5,SEARCH("pages/",H5,1)+5,(SEARCH("/",H5,SEARCH("pages/",H5,1)+6)-(SEARCH("pages/",H5,1)+5)))

 

Could you please help in editing it.

 

to get "Careers" in new column.

 

Regards,

Sri

@harsha449,

 

Specify the fourth parameter NotFoundValue as well.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

When i try to use 4th parameter, I'm getting a error message saying i have used many arguments.

 

Thanks,

Sri

Hi Sam,

 

Could you please help me with this.

 

Thanks,

Sri

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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