Mathematical and trigonometric functions are an integral part of Power BI's formula language. These functions can help you perform complex calculations and analyses in your data models, and create dynamic visualizations that provide insights into your data. In this article, we will explore some of the most commonly used mathematical and trigonometric functions in Power BI, along with detailed examples to help you understand their usage.
Mathematical Functions:
ABS - The ABS function returns the absolute value of a number. For example, ABS(-5) returns 5. The syntax for the ABS function is: =ABS(number)
CEILING - The CEILING function returns the smallest integer greater than or equal to a number. For example, CEILING(3.14159) returns 4. The syntax for the CEILING function is: =CEILING(number, significance)
FLOOR - The FLOOR function returns the largest integer less than or equal to a number. For example, FLOOR(3.14159) returns 3. The syntax for the FLOOR function is: =FLOOR(number, significance)
ROUND - The ROUND function rounds a number to a specified number of digits. For example, ROUND(3.14159, 2) returns 3.14. The syntax for the ROUND function is: =ROUND(number, num_digits)
Trigonometric Functions:
SIN - The SIN function returns the sine of an angle in radians. For example, SIN(Ï€/2) returns 1. The syntax for the SIN function is: =SIN(number)
COS - The COS function returns the cosine of an angle in radians. For example, COS(Ï€) returns -1. The syntax for the COS function is: =COS(number)
TAN - The TAN function returns the tangent of an angle in radians. For example, TAN(Ï€/4) returns 1. The syntax for the TAN function is: =TAN(number)
ASIN - The ASIN function returns the inverse sine of a number, in radians. For example, ASIN(1) returns π/2. The syntax for the ASIN function is: =ASIN(number)
ACOS - The ACOS function returns the inverse cosine of a number, in radians. For example, ACOS(-1) returns π. The syntax for the ACOS function is: =ACOS(number)
ATAN - The ATAN function returns the inverse tangent of a number, in radians. For example, ATAN(1) returns π/4. The syntax for the ATAN function is: =ATAN(number)
Examples:
- Calculating the average of a range of numbers:
= AVERAGE(5, 10, 15, 20) returns 12.5
- Calculating the square root of a number:
= SQRT(16) returns 4
- Calculating the sum of a range of numbers:
= SUM(5, 10, 15, 20) returns 50
- Calculating the sine of an angle in radians:
= SIN(Ï€/2) returns 1
- Calculating the tangent of an angle in radians:
= TAN(Ï€/4) returns 1
- Calculating the inverse cosine of a number, in radians:
= ACOS(-1) returns π
In conclusion, mathematical and trigonometric functions in Power BI are powerful tools that can help you perform complex calculations and analyses in your data models. By understanding how to use these functions, you can create dynamic reports that provide insights into your data, and make more informed decisions based on your findings.