TAN

How to Use the Power BI DAX function TAN

Syntax of TAN Function

The syntax for TAN function is as follows:


TAN(❰number❱)


In this syntax, the ❰number❱ represents an angle in radians for which you want to calculate the tangent.

Example

Let's demonstrate the usage of TAN function with an example. Suppose you have a table named 'Angle' in your Power BI report with the following data:

| Angle |

|-------|

| 0.5 |

| 1 |

| 1.5 |

| 2 |

To calculate the tangent of each angle in the 'Angle' table, you can use the following DAX formula:


TAN(Angle[Angle])


This formula will return the following table:

| TAN |

|-------|

| 0.546 |

| 1.557 |

| -2.214|

| -2.185|

Usage of TAN Function

The TAN function can be used to perform various mathematical calculations in Power BI. Here are a few examples:

Calculate the angle of a right triangle

Suppose you have the following data of a right triangle in your Power BI report:

| Side 1 | Side 2 |

|--------|--------|

| 3 | 4 |

To calculate the angle of the right triangle, you can use the following DAX formula:


TAN(3/4)


This formula will return the angle in radians, which is 0.93.

Calculate the slope of a line

Suppose you have the following data of a line in your Power BI report:

| X | Y |

|-----|-----|

| 3 | 4 |

| 5 | 6 |

| 7 | 8 |

To calculate the slope of the line, you can use the following DAX formula:


TAN((Y[Max]-Y[Min])/(X[Max]-X[Min]))


This formula will return the slope of the line, which is 1.

Calculate the growth rate

Suppose you have the following data of sales in your Power BI report:

| Year | Sales |

|------|-------|

| 2019 | 100 |

| 2020 | 150 |

| 2021 | 200 |

To calculate the growth rate of sales, you can use the following DAX formula:


TAN((LN(Sales[Max]/Sales[Min]))/(MAX(Year[Year])-MIN(Year[Year])))


This formula will return the growth rate of sales, which is 0.33.

In conclusion, the TAN function in Power BI can be used to perform various mathematical operations, such as calculating the angle of a right triangle, the slope of a line, and the growth rate. Understanding the syntax and usage of the TAN function can help you make more informed decisions when analyzing data in Power BI.

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

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)