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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Hidrolix
Frequent Visitor

search word and use it as slicer

Hi all,

 

I try to find a word in a string that is delmited by a "space".

Since I use direct query, I can't use the delmiter from the power query editor.

 

The string contains always 2 parts.

1st part is management domain (MD)

2nd part is availability zone 

Example of string: Testlab Blue

 

I already got an first kolumn for the slicer working. As in the example the "testlab".

Beforespace =
var _searchspatie=SEARCH(" ",'CustomField MD'[MD],1,0)
Return
IF(_searchspatie=0,'CustomField MD'[MD],LEFT('CustomField MD'[MD],_searchspatie-1))

 

 

Now I created the for the 2nd part, so after the space:

Afsterspace =
var _searchspatie=SEARCH(" ",'CustomField MD'[MD],1,0)
Return
IF(_searchspatie=0,'CustomField MD'[MD], RIGHT('CustomField MD'[MD],_searchspatie-1))

 

This returns now: "lab red" or "ab blue"

 

MD = string that contains info

before space = text before space

after space = text after space (not working)

 

Hidrolix_0-1713957398979.png

 

Can someone help me to make it work ? 

 

1 ACCEPTED SOLUTION
kleigh
Resolver III
Resolver III

RIGHT takes a number of characters as an argument, not a string position. So you need to subtract the found position from the string's whole length.

View solution in original post

1 REPLY 1
kleigh
Resolver III
Resolver III

RIGHT takes a number of characters as an argument, not a string position. So you need to subtract the found position from the string's whole length.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.