KNOWLEDGE BASE

## POWER() Function Returns NULL When Taking Odd Roots of Negative Numbers

Published: 26 Oct 2016
Last Modified Date: 27 Oct 2016

### Issue

When taking the n-th (i.e. first, ninth, seventh, third) root of a negative integer numbers using the POWER() function, Tableau Desktop returns NULL.

Tableau Desktop

### Resolution

Create a calculated field for odd values.
1. Select Analysis > Create Calculated Field
2. In the Create Calculated Field dialog box, do the following and click OK:
3. Name the field. In the example, this field is called "Odd values" and enter the following formula:
```IF [Val] >= 0
THEN POWER([Val],1/n)
ELSE -POWER(abs([Val]), 1/n)
END
```
4. Define the n by the root of negative number. For example:
```IF [Val] >= 0
THEN POWER([Val],1/3)
ELSE -POWER(abs([Val]), 1/3)
END```

### Additional Information

For the even values of n, the result of the following calculated field is correct POWER([Value],1/n), for example: POWER(-2,1/2) = NULL.
Did this article resolve the issue?