Built-in Functions → isNumeric

isNumeric() is a boolean function that returns true if a value evaluates as a number, otherwise, it returns false.

Signature

isNumeric(value)

Returns

boolean

The following table illustrates the isNumeric() function input value and output:

isNumeric(value) Returns
isNumeric(123) True
isNumeric(“123”) True
isNumeric(‘123’) True
isNumeric(-1) True
isNumeric(“-1”) True
isNumeric(“$10”) True
isNumeric(12.3) True
isNumeric(“12.3”) True
isNumeric(2*4+5) True
isNumeric(“2*4+5”) False
isNumeric(-2.2E-30) True
isNumeric(“-2.2E-30”) True
isNumeric(“”) False
isNumeric(“+ABC”) False

Example

Determine which postal codes of customers are numeric.

isNumeric(
    SALES.CUSTOMERS.CUST_POSTAL_CODE
    )

The isNumeric() function will test all items in the CUST_POSTAL_CODE column and return true for those that are numeric and false otherwise.


Use the following steps for detailed instructions on how to use the isNumeric() boolean function to tackle the above example in an insight :

Note

In the Cluster Management Console (CMC), create a tenant that includes Sample Data. The Sample Data includes the SALES schema.

  • In the Navigation bar, select the Content tab, and then select + New → Add Dashboard.
  • In the Add Dashboard dialog, for Name, enter Product Dashboard, and then select Add.
  • In the Action bar, select + (add icon), or select + Add Insight.
  • In the Insight panel, select Listing Table or V.
  • In Tables, select Aggregated Table.
  • In the Data panel, select Manage Dataset.
  • In the Manage Data Sets panel, in Tables, select SALES. Close the panel.
  • From the Data panel, drag and drop the following columns to the respective tray:

    • State/Province and ZIP Code from the CUSTOMERS table to the Grouping Dimension tray.
    • Revenue from the SALES table to the Measure tray.

      • In the Properties panel, for Number Format, select Dollar Rounded.
  • From the Data panel, drag and drop Add Formula to the Grouping Dimension tray.
    The Formula Builder automatically opens:

    • In Search Functions, select the down arrow, and then select Boolean Functions.
    • Double-click the isNumeric function, isNumeric(value), to add the formula to the editor.
    • In the Formula Editor, replace value with ZIP Code from the Data panel.
    isNumeric(SALES.CUSTOMERS.CUST_POSTAL_CODE)
    • Select Validate & Save.
  • In the Properties panel, for Column Label, enter isNumeric().
  • Name the insight Revenue Per Category.
  • In the Action bar, select Save.