The following worked:
= -1 * Sum(([pres]="scr")*[gain])
Can anyone tell me why I am returning the opposite value without multiplying
my answer by -1?
'pres' is a text field
'gain' is a number field that may be a positive or negative value.
> PERHAPS what you are looking for is
>
[quoted text clipped - 22 lines]
> > and it returned a negative value when it should have been positive and
> > positive when it should have been negative.
Tom Lake - 30 May 2006 19:25 GMT
> The following worked:
>
[quoted text clipped - 3 lines]
> multiplying
> my answer by -1?
Internally, true values are stored as -1, false as 0.
Since ([pres]=0) is either true or false, it returns 0 or -1.
Tom Lake
Tom Lake - 30 May 2006 19:45 GMT
>> The following worked:
>>
[quoted text clipped - 6 lines]
> Internally, true values are stored as -1, false as 0.
> Since ([pres]=0) is either true or false, it returns 0 or -1.
That should be ([pres]="scr") is either true or false of course.
> Tom Lake
John Spencer - 30 May 2006 21:33 GMT
Because you are muliplying by a negative number.
[pres]="scr") returns -1 (true) or 0 (False). and Sum of all the -1 is a
negative number.
You could rewrite this to
= Sum(IIF([pres]="scr",1,0)) * [Gain]
or
=Count(IIF([pres]="scr",1,Null)) * Gain
> The following worked:
>
[quoted text clipped - 35 lines]
>> > and it returned a negative value when it should have been positive and
>> > positive when it should have been negative.