Creating Constraint

Hi All,

I am working on form creation.
which has option Total population
where i need to write constraints while entering male,female,kids and others details ie.., after entering all fields entered values should not be greater than total population
i have tried below way
total population : 400
male : (.<=($totalpopulation}))
female : ((.+${male})-(${totalpopulation}))
Kids : ((.+${male}+${female})-(${totalpopulation}))
others: ((.+${male}+${female}+${kids})=(${totalpopulation}))
suggest me with better solution

Thanks in advance.

Check the attached XLSForm.constraint_on_total_populations.xlsx (14.5 KB)

Thank you.
It was helpful for my thought process.