Creating a new variable within a form based on previous selection


I have a form with a select date variable, using the yyyy format. Based on the year that they select, I would like to create a new (preferably hidden) variable that generates this selection in the format of a two year range (e.g. yyyy-yyyy) with the first year in the range being the one selected in the previous question. I could manipulate the data set after exporting using a different software, but it would easier to add a calculate question within the form so that the new variable exists prior to exporting. Is this possible?


  1. Please select the year:

  2. Season (auto-calculated):


Hi @caratupps,

Following these steps should work:

  • Convert your year to decimal-date-time(),
  • Create a calculate question and add the needed days to the decimal mentioned above
  • Reconvert to year with date()

Here is more information from ODK Docs, about the functions I mentioned:

1 Like

@caratupps, should the auto-calculated value be a +1 of any year the user enters in Q1? e.g. if a user enters 2025 in Q1 the auto-calculated value should be 2025-2026 in Q2.

@Kal_Lam Yes, that’s correct.

Hi @hakan_cetinkaya. Thanks for the suggestion, but I don’t really understand the process after reading about the functions. Is it possible to do this within form builder or would I need to make my own formula in the calculation column of the xls form? Would the formula be nested, as in date(calculate(decimal-date-time(question_1)+365))?