Extract numeric portion of a string

I’ve a string field which has duration in this format “10 mins”. I want to extract the numeric part 10. Left, substring functions may not be helpful since the length of the numeric part can vary. Any built-in function in QuickSight that does this?

Hi @shyamal , you can try parseInt() or parseDecimal() see if they serve the need.

Hey Emily! I tried parseInt() which I thought should work, but it’s not. The field I’m using is a string (example values : 2 min, 10 min) and I’m trying to extract just the number. Any thoughts on why this would be returning null?

You can try using a combination of parseInt and split as follows:

parseInt( split( {duration}, ' ', 1) )
1 Like

That totally worked!! Thank you @darcoli