Forum Discussion

Sagejah9's avatar
Sagejah9
Helper III
4 years ago
Solved

Extract the number before the string days

Hi, I am trying to extract the number before days from the string 2 days or 1.5 days. How can I do so using DAX ?

 

  • Much easier to do that within the query editor with Text.BeforeDelimiter([YourColumn], " Days").  But here is an expression to do it with a DAX column.  Replace Days[Days] with your actual Table[Column]

     

    JustNumber = Left(Days[Days], SEARCH(" d", Days[Days],1,0))
     
     

    Pat

2 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    Much easier to do that within the query editor with Text.BeforeDelimiter([YourColumn], " Days").  But here is an expression to do it with a DAX column.  Replace Days[Days] with your actual Table[Column]

     

    JustNumber = Left(Days[Days], SEARCH(" d", Days[Days],1,0))
     
     

    Pat