# Atan2

## Syntax of Atan2 Function

The syntax of the Atan2 function in Power Fx is as follows:

``` Atan2(y, x) ```

Here, y and x are the two arguments of the Atan2 function. The Atan2 function calculates the arctangent of the quotient of y and x.

## Example

Let’s take an example to understand the Atan2 function better. Suppose we have the following values of y and x:

``` y = 5 x = 3 ```

To calculate the arctangent of the quotient of y and x, we will use the Atan2 function as follows:

``` Atan2(5, 3) ```

The result of this function will be:

``` 1.03038 ```

## Using Atan2 Function in Power Apps

Now that we have understood the syntax and the usage of the Atan2 function, let’s see how we can use it in Power Apps.

Suppose we have a canvas app that displays the coordinates of a point on a graph. We can use the Atan2 function to calculate the angle between the point and the x-axis, which can be useful in various scenarios. For example, we can use this angle to rotate an image in the direction of the point.

To use the Atan2 function in Power Apps, we need to follow these steps:

2. On the OnSelect property of the button, add the following formula:

``` Set(Angle, Atan2(Y-Coordinate, X-Coordinate)) ```

Here, Y-Coordinate and X-Coordinate are the coordinates of the point on the graph.

3. On the Text property of the button, add the following formula:

``` "Angle = " & Round(Angle, 2) & " radians" & Char(10) & "Angle = " & Round(Angle*180/Pi(), 2) & " degrees" ```

This formula will display the angle value in both radians and degrees.

The Power Fx Atan2 function is a powerful tool that can be used to calculate the arctangent of the quotient of two arguments. In Power Apps, we can use this function to calculate the angle between a point and the x-axis, which can be useful in various scenarios. By following the steps mentioned in this article, you can easily use the Atan2 function in your Power Apps.