Trying to calculate the difference (instead of substraction)

Hi, I am trying to use Kobotoolbox to collect some body measurement data. For each person, I need to take 2 measurements first (m1 and m2) and then take one more (m3) if the difference between the first two measurements is more than 0.5. I added a calculation (calc) for m1-m2, then an input box for m3 and a skip logic saying that m3 will only be displayed if calc>0.5. But I forgot that m2 could be greater than m1, so I need to consider the “absolute value” (without considering positive/negative sign) of calc (m1-m2).
How to do that?

@prasenjit_mondal, you should be able to do this by following the instructions outlined below:

In the survey tab of your XLSForm:

Data entry screen as seen in Enketo: _when the difference is less than 0.5)

Data entry screen as seen in Enketo: _when the difference is greater than 0.5)

Reference XLSForm:

Absolute Value.xlsx (8.5 KB)

Thanks @Kal_Lam. Very helpful!!!

1 Like