Daily DAX : Day 303 ATAN

Power BI DAX ATAN Function

The ATAN function in Power BI DAX (Data Analysis Expressions) calculates the arctangent (inverse tangent) of a given number, returning the angle (in radians) whose tangent is the specified value.

Syntax

ATAN(number)
  • number: The value (a real number) for which you want the arctangent.

Return Value

A value in radians between -π/2 and π/2 (approximately -1.5708 to 1.5708).

Use Case

The ATAN function is commonly used in scenarios involving trigonometry, such as calculating angles in geometric or spatial data analysis. For example:

  • Geospatial Analysis: Calculate the angle between two points on a map using the arctangent of the ratio of differences in coordinates (e.g., for navigation or orientation).
  • Engineering: Determine angles in mechanical or structural designs based on ratios of measurements.
  • Data Visualization: Compute angles for custom visuals, such as polar charts or directional indicators.

Example

Suppose you have a table with columns Opposite and Adjacent representing triangle sides. To calculate the angle (in radians) between these sides:

Angle = ATAN('Table'[Opposite] / 'Table'[Adjacent])

If Opposite = 1 and Adjacent = 1, then:

Angle = ATAN(1) ≈ 0.7854 radians (or 45 degrees)

To convert radians to degrees, multiply by 180/PI():

AngleDegrees = ATAN('Table'[Opposite] / 'Table'[Adjacent]) * 180 / PI()

Notes

  • ATAN handles division by zero by returning π/2 or -π/2 if the input approaches infinity.
  • Use ATAN2(y, x) for more complex scenarios where you need the arctangent based on two coordinates.

Comments

Popular posts from this blog

Daily DAX : Day 65 INFO.TABLEPERMISSIONS

Daily DAX : Day 55 PV