## Introduction

This article will help you understand and use Optional Questions in your Questionnaire.

## Optional Questions

Optional questions are a set of questions that are displayed to the user on random, based on a probability value.

You can add one or more optional questions in each group and let the group decide which ones to display.

### Group Maximum Number of Questions

As we mentioned in a previous article, each group has a field called "maximum number of questions". This field determines how many questions of the group will be displayed to the end-user, in display order as they appear in the questionnaire design section.

### Non-Optional Questions

Starting with the non-optional questions, group will include all the non-optional questions until it reaches the max or until they run out.

In the second case, group will start selecting from the optional questions based on their probability. A group may select 0 or more optional questions until it reaches the max value.

### Question Probability

You can mark a question as optional by setting Optional Switch to "on" and setting a probability, as it appears on the following screenshot:

You can either select one of the preset values:

or select Custom and fill in the probability of the question.

## How Probability Works

You can work with question probability in various ways:

- Set a fixed probability for more that one questions and select a set of them.
- Set auto probability for some or all of the questions

### Fixed Probability

You can set your question a fixed probability based on the given preset values or a custom value.

**NOTE**: If the number of optional questions is less than the number of questions needed to fill the group, all questions will be selected. Only questions with 0 probability will be skipped.

Normally, the probability values should sum up to 100%, but you can sum up to less than that to leave room for not selecting a question.

**Example**:

Question |
Probability |

Question 1 | 50% |

Question 2 | 30% |

Question 3 | 10% |

Question 4 | 5% |

From the above example, there is a 5% probability of not selecting any question.

With 2 questions left for the group, we could have the following steps:

- There is 95% probability of selecting the first question
- Select "Question 2"
- There is 65% (95% - 30%) probability of selecting the second question
- Select No Question

Or the following:

- There is 95% probability of selecting the first question
- Select No Question
- There is 95% probability of selecting the second question
- Select "Question 4"

With 1 question left for the group, if the sum of probabilities do not sum up to 100%, there is change that no question is selected.

### Auto Probability

You can set auto-probability to questions that you do not wish to have a specific probability but share the remaining probability equally. This allows you to:

- Have as many questions as you like, with equal probability without editing the values
- Have questions with auto probability and questions with fixed, to provide more weight

**Example**:

Question |
Set Probability |
Real Probability |

Question 1 | 50% | 50% |

Question 2 | 30% | 30% |

Question 3 | auto | 10% |

Question 4 | auto | 10% |

In the above example, "Question 3" and "Question 4" will share the remaining 20% over their count (20/2 = 10% each).

### Examples

Assume we have a group with 5 maximum number of questions:

**Example 1:**

Question |
Optional Status |
Probability |
Selected Question (by Display Order) |

Question 1 | non-optional | - | 1 |

Question 2 | non-optional | - | 2 |

Question 3 | non-optional | - | 3 |

Question 4 | non-optional | - | 4 |

Question 5 | optional | 40% | - |

Question 6 | optional | 30% | 5 |

Question 7 | optional | 30% | - |

**Example 2:**

Question |
Optional Status |
Probability |
Selected Question (by Display Order) |

Question 1 | non-optional | - | 1 |

Question 2 | non-optional | - | 2 |

Question 3 | non-optional | - | 3 |

Question 4 | optional | 50% | 5 |

Question 5 | optional | 30% | - |

Question 6 | optional | 10% | - |

Question 7 | optional | 10% | 4 |

**Example 3:**

Question |
Optional Status |
Probability |
Selected Question (by Display Order) |

Question 1 | non-optional | - | 1 |

Question 2 | non-optional | - | 2 |

Question 3 | non-optional | - | 3 |

Question 4 | optional | 50% | - |

Question 5 | optional | 20% | - |

Question 6 | optional | 5% | - |

Question 7 | optional | 10% | 4 |

In the above example we can see that there is no question selected for no5. This is a probability that might happen if questions' probability do not sum up to 100%.

**Example 4:**

Question |
Optional Status |
Probability |
Selected Question (by Display Order) |

Question 1 | non-optional | - | 1 |

Question 2 | non-optional | - | 2 |

Question 3 | optional | 50% | - |

Question 4 | non-optional | - | 3 |

Question 5 | optional | 20% | 5 |

Question 6 | optional | 5% | - |

Question 7 | optional | 10% | 4 |

In the above example we can see that regardless of the display order, the non-optional questions will be selected first and then the optional questions.

## Troubleshooting

If you having trouble setting up your optional questions, you can Submit a request and we will get back to you as soon as possible.