Forum Discussion

ThomasDay's avatar
ThomasDay
Impactful Individual
10 years ago
Solved

strip all Alpha chars from text string?

Hello fellow DAX'ers, This seems like it should be easy.  I have a column of text data coming into a zip code field.  It's public data meaning sometimes the data reads N/A or the name of a town etc ...
  • Greg_Deckler's avatar
    10 years ago

    Messy, but you could do this:

    NoText = Var NoAs = SUBSTITUTE([address],"a","")
    Var NoBs = SUBSTITUTE(NoAs,"b","")
    Var NoCs = SUBSTITUTE(NoBs,"c","")
    Var NoDs = SUBSTITUTE(NoCs,"d","")
    Var NoEs = SUBSTITUTE(NoDs,"e","")
    Var NoFs = SUBSTITUTE(NoEs,"f","")
    RETURN
    NoFs

    Rinse and repeat for all characters.