Jack Adams Posted February 16 Share Posted February 16 Hello Rulex Community! I have two numerical columns (say Col_1 and Col_2) and I want to define a new column containing which of the two columns is closest to a third column (say Actual). This column should contain "Col_1" or "Col_2". Thank you in advance! Want to know more? Link to comment Share on other sites More sharing options...
Alessandra Casale Posted February 20 Share Posted February 20 Hello Jack! The solution should be the following formula: ifelse(abs($"Col_1"-$"Actual") < abs($"Col_2"-$"Actual"), "Col_1", "Col_2") 1 Want to know more? Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.