Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Convert wind degrees to direction

Hi everyone

 

Can anyone help with how to convert wind degrees to direction. For example, I have the degrees like below but want the column on the right. Thanks in advance!

 

DegDir
202SSW
208SSW
229SW
249WSW
276W
311NW
335NNW
345NNW
24NNE
24NNE
29NNE
34NE
26NNE
22NNE
17NNE
1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Anonymous 

 

You don't describe the ranges for each Dir. I've just used 4 Dirs as an example to show the pattern you can use. You would just have to update/expand the conditions to what you need.  

 

 

NewColumn =
VAR  _Deg = Table1[Deg]
RETURN
   SWITCH(TRUE(),
                (_Deg >= 0 &&  _Deg< 90), "N",
                (_Deg >= 90 &&  _Deg< 180), "E",
                (_Deg >= 180 &&  _Deg< 270), "S",
                (_Deg >= 270 &&  _Deg< 360), "W"

   )

 

View solution in original post

3 REPLIES 3
AlB
Community Champion
Community Champion

Hi @Anonymous 

 

You don't describe the ranges for each Dir. I've just used 4 Dirs as an example to show the pattern you can use. You would just have to update/expand the conditions to what you need.  

 

 

NewColumn =
VAR  _Deg = Table1[Deg]
RETURN
   SWITCH(TRUE(),
                (_Deg >= 0 &&  _Deg< 90), "N",
                (_Deg >= 90 &&  _Deg< 180), "E",
                (_Deg >= 180 &&  _Deg< 270), "S",
                (_Deg >= 270 &&  _Deg< 360), "W"

   )

 

could you tell me, what is this programme? to insert in this code

 

Anonymous
Not applicable

Thanks AIB. I don't fully understand how to implement your solution. I'm sure it works but it got me thinking of a way I could do it through the query editor

 

 #"Added Conditional Column" = Table.AddColumn(#"PREVIOUS STEP", "dir", each 
if [deg] >= 348.75 then "N" else 
if [deg] > 326.25 then "NNW" else 
if [deg] > 303.75 then "NW" else 
if [deg] > 281.25 then "WNW" else 
if [deg] > 258.75 then "W" else 
if [deg] > 236.25 then "WSW" else 
if [deg] > 213.75 then "SW" else 
if [deg] > 191.25 then "SSW" else 
if [deg] > 168.75 then "S" else 
if [deg] > 146.25 then "SSE" else 
if [deg] > 123.75 then "SE" else 
if [deg] > 101.25 then "ESE" else 
if [deg] > 78.75 then "E" else 
if [deg] > 56.25 then "ENE" else 
if [deg] > 33.75 then "NE" else 
if [deg] > 11.25 then "NNE" else 
if [deg] >= 0 then "N" else null ),

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors