Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

Constant Sum Must Total but not mandatory?

Nadaly
Nadaly Community Member, Qualtrics Brand Admin Qubie ✭

Is it possible to custom code a constant sum question so that the responses must total 100%, but it could also be left blank (all rows at 0) as well?

Best Answer

  • [Deleted User]
    [Deleted User] Qubie ✭
    Accepted Answer

    Hello @Nadaly

    The solution is using custom validation.

    In the Constant Sum question add following custom validation

    In the first condition paste the following math operation
    $e{ 100 - ( q://QID24/ChoiceNumericEntryValue/2 + q://QID24/ChoiceNumericEntryValue/3 ) }

    In second condition(after OR) paste the following math operation
    $e{ 0 - ( q://QID24/ChoiceNumericEntryValue/2 + q://QID24/ChoiceNumericEntryValue/3 ) }

    Also, Select "Enforce Range" with 0 as min value, so that the user cannot answer negative values

    Explanation: Suppose you have three rows(A, B, C) then either A= 100-(B+C) OR A=0- (B+C)

Answers

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    Yes, sum the total anytime one of the fields changes, then enable the next button if it totals 0 or 100, otherwise disable the next button.

  • Nadaly
    Nadaly Community Member, Qualtrics Brand Admin Qubie ✭

    @Shashi Thanks. This makes sense. I got it to work using a 2-row question! But it doesn't on one that is 4 rows. Is this bad math?

    $e{ 100 - ( q://QID7/ChoiceNumericEntryValue/2 + q://QID7/ChoiceNumericEntryValue/3 + q://QID7/ChoiceNumericEntryValue/4) }

    $e{ 0 - ( q://QID7/ChoiceNumericEntryValue/2 + q://QID7/ChoiceNumericEntryValue/3 + q://QID7/ChoiceNumericEntryValue/4) }

  • @Nadaly said:
    @Shashi Thanks. This makes sense. I got it to work using a 2-row question! But it doesn't on one that is 4 rows. Is this bad math?

    $e{ 100 - ( q://QID7/ChoiceNumericEntryValue/2 + q://QID7/ChoiceNumericEntryValue/3 + q://QID7/ChoiceNumericEntryValue/4) }

    $e{ 0 - ( q://QID7/ChoiceNumericEntryValue/2 + q://QID7/ChoiceNumericEntryValue/3 + q://QID7/ChoiceNumericEntryValue/4) }

    There should be a space between 4 and ')'

  • _Hannah1073
    _Hannah1073 Community Member Qubie ✭
    edited December 2018

    Hi, I have exactly the same problem but for me the code provided above does not seem to work.
    I am using:
    $e{ 100 - ( q://QID206/ChoiceNumericEntryValue/2 + q://QID206/ChoiceNumericEntryValue/3 + q://QID206/ChoiceNumericEntryValue/4 + q://QID206/ChoiceNumericEntryValue/5 ) }

    and my question looks like this:

  • Nadaly
    Nadaly Community Member, Qualtrics Brand Admin Qubie ✭

    @_Hannah1073
    I tried your code on a slider question and it worked fine for me to prevent someone from moving forward unless the sum was 100. What is happening for you? Are respondents able to move forward with a sum>100?