Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

summation problem

Status
Not open for further replies.

nikol

Programmer
Apr 12, 2005
126
US
Hi,
I'm creating a report in which I have used two formulas
@null & @sum
@sum formula= Sum ({uid}, {Command_2.agegroup}) + Sum ({other}, {Command_2.agegroup})
where uid other @sum
8 8 16
1
7 2 9
then I have used @null formula to get the null value
@null= if isnull ({other}) then
Sum ({other}, {Command_2.agegroup}) +
Sum ({uid}, {Command_2.agegroup})
else {@sum}
It gives me
uid other @null
8 8 16
1 1
7 2 9
Now I want the sum of @null column = "26"

 
My understanding is that you want to count the nulls and then proceed from there with other math.

The approach I would take is a little different than the one you are showing. I would write another formula that returned a 1 if null and a zero if not. Then I would sum based on that formula. It would be the basis of any calculation involving these nulls.

That way you aren't having to dance around the special properties of nulls at each level of your specific report.

So:

numIsNull =

if isnull({other}) then 1 else 0



Put this in on a per record basis. Then all of your other problems with summing should be much easier to solve.

I suppose you could also try and do a summary function (the sigma on your button bar) based on your @null formula. But that wouldn't be my approach.

Hope this helps.

Scottm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top