8 Replies Latest reply on Oct 10, 2018 11:55 PM by gregory.harward

# How to find if a column type if Numeric - alternate to isnumeric()

Does anyone know how to test for numerics in Tableau? There doesn't seem to be a IsNumeric() function.

I tried using the FLOAT() function and check for null but that didn't work either

• ###### 1. Re: How to find if a column type if Numeric - alternate to isnumeric()

will the ZN function work for you?  try it out.

• ###### 2. Re: How to find if a column type if Numeric - alternate to isnumeric()

non null  float or int   should work.  Do you have a an example of a value  (field type + value).

• ###### 3. Re: How to find if a column type if Numeric - alternate to isnumeric()

Your question is kinda confusing. You say you are testing whether a column is of type numeric? And then you say you are checking for null values? ZN will return a value if the expression is not null otherwise returns a zero.

• ###### 4. Re: How to find if a column type if Numeric - alternate to isnumeric()

Hi Syed

Please consider up-voting the following ideas:

http://community.tableau.com/ideas/4651

+

http://community.tableau.com/ideas/1849

There is a comment regarding using float + is null (which is also mentioned above) as a workaround.

Cheers

Mark

• ###### 5. Re: How to find if a column type if Numeric - alternate to isnumeric()

You could use the following calculation to check at the row level:

ABS( INT( [field])>=0

Results:

True=Number

False=Non-Number

Null=Null

To check for every value in the field's domain:

{Fixed : ATTR(ABS( zn(INT( [field]))>=0)}=TRUE

Note:  The ZN is required to convert nulls to zero prior to the aggregation of the entire domain.

• ###### 6. Re: How to find if a column type if Numeric - alternate to isnumeric()

This Calculated Dimension Field (used as a Filter) worked for me (v10.2):

IF STR(INT([Dimension Field]) / 1) = [Dimension Field] THEN "T" ELSE "F" end

• ###### 7. Re: How to find if a column type if Numeric - alternate to isnumeric()

Here you go!

LEN(REGEXP_REPLACE([Seat From Num],'^[0-9]*\$',''))=0

null = null

False = Alphanumeric

True = Numeric

Works by removing all numbers to see if you end up with nothing left

• ###### 8. Re: How to find if a column type if Numeric - alternate to isnumeric()

IsNumeric()

//A modification of Stephen Hicks method where \d removes digits, with other explicitly removed characters defined between [].

//Returns boolean

ISNULL(TRIM([Test]))=FALSE AND

LEN(TRIM(REGEXP_REPLACE(STR([Test]),'(\d)|[.,\$-]','')))=0