Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Split column by delimeter in dax

Hi , I need to split the input column by demieter to display the last character before the occurance of "_" . If there is no "_" then it must display the character itself. So i just need to di...
  • ValtteriN's avatar
    3 years ago

    Hi,

    Here is one way to do this:

    Data:

     

    Dax:

    Measure 24 =
    var _text = MAX('Table (13)'[Column1]) return
    RIGHT(_text,LEN(_text)-SEARCH("_",_text,,0))
    End result:
     

    Edit:

    I noticed this doesn't account for second instance of "_". For that use this dax:

    Measure 24 =
    var _text = MAX('Table (13)'[Column1])
     var first_instance = FIND("_",_text,,0)
     var second_instance = if(FIND("_",_text,first_instance+1,0)=0,first_instance,FIND("_",_text,first_instance+1,0))
     return
    RIGHT(_text,LEN(_text)-IF(first_instance>0,second_instance))



    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/