Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Your file has been submitted successfully. We’re processing it now - please check back in a few minutes to view your report.
DAX doesn't have an ATAN2 function so I created one.
ATAN2 =
VAR __x = MAX('Table'[X])
VAR __y = MAX('Table'[Y])
VAR __atan2 =
SWITCH(
TRUE(),
__x > 0, ATAN(__y/__x),
__x < 0 && __y >= 0, ATAN(__y/__x) + PI(),
__x < 0 && __y < 0, ATAN(__y/__x) - PI(),
__x = 0 && __y > 0, PI()/2,
__x = 0 && __y < 0, PI()/2 * (0-1),
BLANK()
)
RETURN
__atan2
eyJrIjoiNWYyNmRlYzctY2Q1NC00NDQ0LTlkYWQtOTVhNjljMTMzN2RjIiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9
@Greg_Deckler Hi Greg, I am trying to find wind direction on PowerBI. To do that I need arctan(V/U) and then convert it into degrees. I cannot have a negative degree so I need it to go around the entire unit circle (0-360). Do you have any sugguestions? Note: if the value of V is negative, the component is south. If V is positive, the component is north. If U is negative, the component is west. If U is positive, the component is east.
@Anonymous OK, so ATAN2 should work for you if you plug V in for y and U in for x I believe.
Thanks Greg!