Making a response negative based on a previous response

317
2
12-18-2020 01:41 PM
HenryPittman
New Contributor II

Hi, This seems like a simple question to me so hopefully someone can help me out before waste too much time working on it. I'm trying to make a decimal value ${Amount} negative based on the response to a previous select_one questions, Is the amount an expense or deposit? Simple enough I would think. 

I used an if statement in the calculation column to try to accomplish this. Here is the syntax

if(selected(${Transaction_Type},'Expense'),-${Amount},${Amount})

This returns an error. I've tried variants of this syntax with no luck. Like I said seems simple enough. Am I just overlooking something simple or is there a better way to do this? 

Thanks for the help,

Tyler

Tags (2)
0 Kudos
2 Replies
MicZatorsky_AEC
Occasional Contributor II

One solution is to use a second, read-only field.  Working XLSX attached.  

MicZatorsky_AEC_1-1608493568478.pngMicZatorsky_AEC_2-1608493617129.png

 

0 Kudos
HenryPittman
New Contributor II

Thanks so much I knew it was something simple. It didn't like the circular nature of trying to do the calculation in the same filed that the data was enter just wouldn't work. I ended up using it in a calculate question type to hide that from the user and all is well. 

Thanks,

Tyler