New column generation (USING FORMULA) based on a set of conditions

Solved!
ranjith
Level 2
New column generation (USING FORMULA) based on a set of conditions

I want to create a new column using an existing one ( A numerical field having values from 0-100) 

I'd like my new column to score the values as

0-15 ->

16-30 ->4   

31-45 ->3 

46-60 -> 2 

61-rest ->1

Can I use formula" on the existing column to achieve this? 

0 Kudos
1 Solution
VinceDS
Dataiker

Hi, 

Yes indeed you can use Formula processor with nested 'if()' conditions to achieve your value remapping.

You can also use "Discretize (bin) Numerical values" from the processor list with a custom raw value remapping and enter your boundaries and target values.

Screenshot 2020-04-01 at 15.35.41.png
 
Hope this helps

View solution in original post

3 Replies
VinceDS
Dataiker

Hi, 

Yes indeed you can use Formula processor with nested 'if()' conditions to achieve your value remapping.

You can also use "Discretize (bin) Numerical values" from the processor list with a custom raw value remapping and enter your boundaries and target values.

Screenshot 2020-04-01 at 15.35.41.png
 
Hope this helps
ranjith
Level 2
Author

 I actually implemented the binning logic! 

Wasn't sure if that was the right way to go about it though. 

Thanks for the solution + reassurance. Cheers!  ๐Ÿ™‚

Usersyed
Level 3

Is there a way to define bins based on a different variable? 
For example if there is a data point with type as type 1 then use  bins like 1-15, 15-20 etc for it and if the type is type 2 , then use bins like 1-5, 5-10 and so on?

0 Kudos