Forum Discussion

HughLa's avatar
HughLa
Resolver IV
3 years ago
Solved

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...
  • v-yalanwu-msft's avatar
    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.