##### Page tree

Release 8.7.1

Contents:

Our documentation site is moving!

For up-to-date documentation of release 8.7 of Self Managed Designer Cloud, please visit us at https://help.alteryx.com/SMC/r87/.

Computes the square root of the input parameter.  Input value can be a Decimal or Integer literal or a reference to a column containing numeric values. All generated values are non-negative.

Wrangle vs. SQL: This function is part of Wrangle, a proprietary data transformation language. Wrangle is not SQL. For more information, see Wrangle Language.

## Basic Usage

Numeric literal example:

`sqrt(25)`

Output: Returns the square root of 25, which is `5`.

Column reference example:

`sqrt(MyValue)`

Output: Returns the square root of the values of the `MyValue` column.

## Syntax and Arguments

`sqrt(numeric_value)`

ArgumentRequired?Data TypeDescription
numeric_valueYstring, decimal, or integerName of column or Decimal or Integer literal to apply to the function

### numeric_value

Name of the column or numeric literal whose values are used to compute the square root.

NOTE: Negative input values generate null output values.

• Missing input values generate missing results.
• Literal numeric values should not be quoted.
• Multiple columns and wildcards are not supported.

Usage Notes:

Required?Data TypeExample Value
YesString (column reference) or Integer or Decimal literal`25`

## Examples

### Example - Pythagorean Theorem

The following example demonstrates how the `POW` and `SQRT` functions work together to compute the hypotenuse of a right triangle using the Pythagorean theorem.
• `POW` - X Y . In this case, 10 to the power of the previous one. See POW Function
• `SQRT` - computes the square root of the input value. See SQRT Function.

The Pythagorean theorem states that in a right triangle the length of each side (x,y) and of the hypotenuse (z) can be represented as the following:

z2 = x 2 + y 2

Therefore, the length of z can be expressed as the following:

z = sqrt(x 2  + y 2 )

Source:

The dataset below contains values for x and y:

XY
34
49
810
3040

Transformation:

You can use the following transformation to generate values for z2

Transformation Name `New formula` `Single row formula` `(POW(x,2) + POW(y,2))` `'Z'`

You can see how column Z is generated as the sum of squares of the other two columns, which yields z2.

Now, edit the transformation to wrap the value computation in a `SQRT` function. This step is done to compute the value for z, which is the distance between the two points based on the Pythagorean theorem.

Transformation Name `New formula` `Single row formula` `SQRT((POW(x,2) + POW(y,2)))` `'Z'`

Results:

XYZ
345
499.848857801796104
81012.806248474865697
304050