Forum Discussion
HughLa
3 years agoResolver IV
DAX SEARCH Function using a variable as start position.
Hi I would like to know if there is a work around or if it is possible at all to use a variable in the SEARCH function. I theoretically want to find the second occurance of a value in a strin...
- 3 years ago
Hi, HughLa ;
Since the position of search() cannot start from 0, because the result after your first search has 0; So the second lookup needs to start at +1. You can refer to the following formula:
Column = var _posi=SEARCH("-",[NAME],1,0) return SEARCH("-",[NAME],_posi+1,_posi)The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yalanwu-msft
3 years agoCommunity Support
Hi, HughLa ;
Since the position of search() cannot start from 0, because the result after your first search has 0; So the second lookup needs to start at +1. You can refer to the following formula:
Column =
var _posi=SEARCH("-",[NAME],1,0)
return SEARCH("-",[NAME],_posi+1,_posi)
The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- HughLa3 years agoResolver IV