6 Replies Latest reply on Jul 6, 2016 3:09 PM by Hildebrando Souza Jr

# Not working: IF [Response]="Strongly Agree" AND [Response]="Agree" THEN [Value(Percentage)] END

I need to get the SUM of Strongly Agree and Agree for the data set below. This is my calculation, but it's not working:

if [Response]="Strongly Agree" AND [Response]="Agree" then [Value(Percentage)] END

• ###### 1. Re: Not working: IF [Response]="Strongly Agree" AND [Response]="Agree" THEN [Value(Percentage)] END

A single row cannot have both values, so you'd need to calculate it like this:

if [Response]="Strongly Agree"  THEN [value(percentage]

ELSEIF [Response]="Agree" THEN [value(percentage]

END

Think that'll do the trick, if you can post a twbx I can give it a whirl.

2 of 2 people found this helpful
• ###### 2. Re: Not working: IF [Response]="Strongly Agree" AND [Response]="Agree" THEN [Value(Percentage)] END

Thank you! I got the output below. How do I SUM "Strongly Agree" AND "Agree" though.

• ###### 3. Re: Not working: IF [Response]="Strongly Agree" AND [Response]="Agree" THEN [Value(Percentage)] END

You can group the values of Response and just use the measure.

This is wrong:

if [Response]="Strongly Agree"  THEN [value(percentage]

ELSEIF [Response]="Agree" THEN [value(percentage]

END

Simplify:

if [Response]="Strongly Agree" OR [Response]="Agree"  THEN [value(percentage] end

1 of 1 people found this helpful
• ###### 4. Re: Not working: IF [Response]="Strongly Agree" AND [Response]="Agree" THEN [Value(Percentage)] END

Obrigado! The result is showing the same as Tina's solution. I think we are missing the SUM command somewhere.

• ###### 5. Re: Not working: IF [Response]="Strongly Agree" AND [Response]="Agree" THEN [Value(Percentage)] END

If you split your data as shown above using response in the view, the calculation will showup only where the response value is 'Strongly Agree' or 'Agree'.

If you remove 'response' from the view, it would aggregate these two values.

or like Luciano suggested, group the two responses and then try.

1 of 1 people found this helpful
• ###### 6. Re: Not working: IF [Response]="Strongly Agree" AND [Response]="Agree" THEN [Value(Percentage)] END

Hi Diogo,

You can also right click on response field and click Create >> Group, then group "Strongly Agree" and "Agree". Now you can use this new field "Response (Group)" and substitute [Response] for this new one. Now you should have [value(percentage] adding "Strongly Agree" and "Agree".