Hi hoping someone can help I've got multiple if statement which I would be fine writing in excel but struggling in powerquery (the below is not working expecting another then?!) would appreciate any help and what the best practice would be for the below and if anyone can make it work that would be great. Thank you.
= Table.AddColumn(#"Added Custom", "Custom",
each if [Adjust]="monkey"
then if[Pear]>0
then if[Banana]>0
then if [Apple]>0
then ([Banana]+[Pear]+[Apple])/3
else if [Apple Juice]<0
Then 0
else ([Pear]+[Banana])/2
else if [Apple]>0
then ([Pear]+[Apple])/2
else if [Banana Smoothie]>0
then [Pear]
else 0
else if [Banana]>0
Then if [Apple]>0
then if [pear juice]<0
then ([Banana]+[apple])/3
else [Banana]+[apple])/2
else if [pear juice]<0
then [Banana]/2
else [Banana]
else if [Apple]> 0
then if [Banana Smoothie]<0
then 0
else if [pear juice]<0
then [Apple]/2
else [Apple]
else 0
else 0)
= Table.AddColumn(#"Added Custom", "Custom",
each if [Adjust]="monkey"
then if[Pear]>0
then if[Banana]>0
then if [Apple]>0
then ([Banana]+[Pear]+[Apple])/3
else if [Apple Juice]<0
Then 0
else ([Pear]+[Banana])/2
else if [Apple]>0
then ([Pear]+[Apple])/2
else if [Banana Smoothie]>0
then [Pear]
else 0
else if [Banana]>0
Then if [Apple]>0
then if [pear juice]<0
then ([Banana]+[apple])/3
else [Banana]+[apple])/2
else if [pear juice]<0
then [Banana]/2
else [Banana]
else if [Apple]> 0
then if [Banana Smoothie]<0
then 0
else if [pear juice]<0
then [Apple]/2
else [Apple]
else 0
else 0)