Forum Discussion
FIND and SUBSTITUTE
- 6 years ago
hi Anonymous
There are two mistake in your Position formula
1.
SUBSTITUTE(<text>, <old_text>, <new_text>, <instance_num>)
For <instance_num>, it could not be 0, so you need to add a IF conditional in the formula
https://docs.microsoft.com/en-us/dax/substitute-function-dax
2.
FIND(<find_text>, <within_text>[, [<start_num>][, <NotFoundValue>]])
For FIND function, it will return the starting position of one text string within another text string, but if there is no result and you need to define a <NotFoundValue>
https://docs.microsoft.com/en-us/dax/find-function-dax
So adjust the formula as this
Position = IF([Count]>0, FIND(";;",SUBSTITUTE([All Involved],"Triage","",[Count]),1,0)+1)Regards,
Lin
hi Anonymous
There are two mistake in your Position formula
1.
SUBSTITUTE(<text>, <old_text>, <new_text>, <instance_num>)
For <instance_num>, it could not be 0, so you need to add a IF conditional in the formula
https://docs.microsoft.com/en-us/dax/substitute-function-dax
2.
FIND(<find_text>, <within_text>[, [<start_num>][, <NotFoundValue>]])
For FIND function, it will return the starting position of one text string within another text string, but if there is no result and you need to define a <NotFoundValue>
https://docs.microsoft.com/en-us/dax/find-function-dax
So adjust the formula as this
Regards,
Lin