Nested IF with OR
![Edouard](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar8.png)
Hi Guys,
I'm struggling to write the following formula using IF and OR
IF Anp_SPIKE_Class_lead1 is equal to '1' OR Anp_SPIKE_Class_lead2 is equal to '1' then Fill in '1' ELSE Fill in '0' END
IF (OR Anp_SPIKE_Class_lead1==1, Anp_SPIKE_Class_lead2==1, 1, 0)
Any help would be greatly appreciated.
Thank you.
Best Answers
-
tgb417 Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Frontrunner 2022 Finalist, Frontrunner 2022 Winner, Dataiku Frontrunner Awards 2021 Participant, Frontrunner 2022 Participant, Neuron 2023 Posts: 1,598 Neuron
You have not said where in DSS you are trying to write this formula. I'm going to guess that you are trying to use a visual recipe formula step.
In that case you were very close. You might try an extra set of "(" and ")" and the functions "if" and "or" are case sensitive. Try something like this.
if(or(Anp_SPIKE_Class_lead1==1, Anp_SPIKE_Class_lead2==1), 1, 0)
I hope that help out.
Here is a link to a related conversation if the above does not work out for you.
https://community.dataiku.com/t5/Using-Dataiku-DSS/Nested-IF-with-OR-inbetween/td-p/10987
Welcome to the Dataiku Community.
-
Superb! Thank you, Tom.