Using the if statement in Kobo

I am trying to use an if statement to do a calculation but it is not working. Please can someone help with how it should be done?
For example: is a calculation Z1=P1+P2+P3
X1 is optional: yes or no

**${if(X1)=yes, 0%Z1 and if(X1)=no, 67%Z1}
The above if statement is what I want to achieve but it is not working.

@velbon, you could do it as outlined in the image shared below:

In the survey tab of your xlsform:

In the choices tab of your xlsform:

Image 2

Data entry screen as seen in Enketo:

Reference xlsform:

If-Statement.xlsx (13.3 KB)