Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Negative Value is adding on to Positive value for some reason?

Deano478
12 - Quasar

Hi Community,

 

This might be a super simple one but my maths is simply failing me big time.

 

Basically I have two values a negative value and a positive value and I need to subtract the negative value from the positive value, however when I subtract them the negative value is being added on to the Positive value and increasing it.

 

I have no idea how to fix this so any help would be terrific,

 

cheers everyone

 

Here is a a sample of the two values and the formula I have tried to use:

 

Formula: [Value 2]-[Value 1]

 

CodeCompanyNameValue 1Value 2 Total2021
ABC021_CTest Company Limited 1 -75020002750TRUE
10 REPLIES 10
BS_THE_ANALYST
14 - Magnetar

Reason: you're trying to subtract a negative number. Recall: x--y = x+y.

You could solve your issue by doing the following [Value2]-abs([Value1]).

 

This will make Value 1 positive. So rather than 2000 - (-750), it will be 2000 - (750)

FinnCharlton
13 - Pulsar

Subtracting a negative number from X increases the value of X. Alteryx is calculating the formula correctly. You might want to add the numbers together instead? 

Deano478
12 - Quasar

@BS_THE_ANALYST  WOW I'm genuinely embarrassed by my maths cheers for that the issue is fixed now 

binuacs
20 - Arcturus

@Deano478 

 

BS_THE_ANALYST
14 - Magnetar

If you are always trying to find the 'total' between the two columns. Just add them together. 

i.e.

val1: 4000  val2: 3000 total = 7000 -> 4000+3000

val1: 4000 val2: -3000 total = 1000 -> 4000+-3000 

val1: -4000 val2: -3000 total = -7000 -> -4000+-3000 

val1: -4000 val2: 3000 total = -1000 -> -4000 + 3000 

 

All possibilities covered so you can rest assured adding the two columns will always return the total @Deano478 

Deano478
12 - Quasar

@BS_THE_ANALYST  Much appreciated i never knew about the ABS function so I was sat here struggling so looks like I learned something new today 

Deano478
12 - Quasar

hey again @BS_THE_ANALYST  just one more question for you I was working away using the ABS function and one of my calculations is:

 

Value1: 200 

Value2: 8660

 

But when I try to subtract them using: [Value2]-ABS([Value1]) it does nothing in this case for some reason? 

 

heres a snippet of the output:

 

Deano478_0-1674131681615.png

 

Deano478
12 - Quasar

@BS_THE_ANALYST  Please ignore my last reply my apologies 

BS_THE_ANALYST
14 - Magnetar

Hi @Deano478 .. so to clarify what the 'ABS' function is doing. It takes any value, and makes it positive! 

 

So if you do this -> ABS(-400) it will pop out 400 as the result

So if you do this -> ABS(400) it will pop out 400 as the result

 

I think you were expecting to see the number 9060 as your result here because you're trying to work out the TOTAL;

i.e.: 

To work out the total, just do this [Value2]+[Value1]. 

 

Remember, the ABS function is just to make a number positive! I hope that makes sense? Adding negatives and subtracting negative numbers can be mind boggling!

Labels