Tan

How to Use the Power Fx Tan Function in Power Apps

What is the Tan Function?

The Tan function is a mathematical function that returns the tangent of a given angle. This function takes a single argument that represents the angle in radians. It is important to note that the input angle must be in radians, not degrees.

In Power Apps, the Tan function is available as a part of the Power Fx language. Power Fx is the formula language used by Power Apps and is similar to Excel formulas.

How to Use the Tan Function in Power Apps

Using the Tan function in Power Apps is easy once you understand the syntax. The syntax for the Tan function is as follows:


Tan(number)


The `number` parameter represents the angle in radians that you want to calculate the tangent of. Let's see an example of how to use the Tan function in Power Apps.

Suppose you want to calculate the tangent of an angle of 45 degrees. First, you need to convert 45 degrees to radians. This can be done by multiplying the angle in degrees by `PI()/180`. The `PI()` function returns the value of pi (3.14159...) and `180` is the number of degrees in a circle.


Tan(45*PI()/180)


This will return the value of `1`, which is the tangent of an angle of 45 degrees.

Using the Tan Function in Power Apps Formulas

Now that you know how to use the Tan function, let's see an example of how to use it in a Power Apps formula. Suppose you have a Power Apps form that collects the length and width of a rectangle and you want to calculate the diagonal of the rectangle.

To calculate the diagonal, you can use the Pythagorean theorem, which states that the square of the hypotenuse (diagonal) of a right triangle is equal to the sum of the squares of the other two sides. In this case, the length and width of the rectangle are the other two sides.

The formula for calculating the diagonal of a rectangle is:


SquareRoot(Power(Length, 2) + Power(Width, 2))


To use the Tan function in this formula, suppose you want to calculate the angle between the length and the diagonal of the rectangle. You can use the following formula:


Tan(Length/Diagonal)


This will return the tangent of the angle between the length and the diagonal of the rectangle.

The Tan function is a powerful mathematical function available in Power Apps that can help you perform complex calculations. By using the Tan function, you can calculate the tangent of a given angle, which can be useful in a variety of applications. Now that you know how to use the Tan function in Power Apps, try incorporating it into your next application to see what you can accomplish.

Power Apps Training Courses by G Com Solutions (0800 998 9248)