Forum Discussion
SUBSITUTE function does not work correctly in DirectQuery mode
- 3 years ago
Anonymous Any chance you can use a measure? More DAX functions are supported in measures rather than calculated columns. Also, if you can use SUBSTITUTE in a measure and replace all occurences with "|" (pipe character) then you can use PATHITEM to retrieve individual parts instead of using FIND, MID, etc.
Anonymous Why can't you just turn it into a PATH by replacing each instance with "|". Why do you need to replace each one individually?
- Anonymous3 years agoNot applicable
Hi Greg_Deckler ,
Thank you for your message!
For example, in order to extract the second process from a string that contains 6 processes the code is the following:PR2 = IF(Table1[NumberOfProcesses]<=1,"",var aux1 = SUBSTITUTE(Table1[Processes_0],"|,|","*",1)var aux2 = SUBSTITUTE(aux1,"|","*",2)var First = FIND("*",aux2,1,0)var Last = FIND("*",aux2,First+1,500)var Diff = Last-First-1var Final = MID(aux2,First+1,Diff)return Final)
Is the case more clear now?Thank you,Diana 🙂- Greg_Deckler3 years ago
Community Champion
Anonymous Any chance you can use a measure? More DAX functions are supported in measures rather than calculated columns. Also, if you can use SUBSTITUTE in a measure and replace all occurences with "|" (pipe character) then you can use PATHITEM to retrieve individual parts instead of using FIND, MID, etc.
- Anonymous3 years agoNot applicable
Hi Greg_Deckler ,
Thank you a lot for the solution.
I used the PATHITEM function to split my string in multiple columns.
Have a wonderful day!
Dia