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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with counts...

Status
Not open for further replies.

stormtrooper

Programmer
Apr 2, 2001
266
CA
Hello. I hope somebody can help me out on this one.

I have a field called 'billable' that contains a 1 or 0. I have a formula called '@paid' that uses the 'billable' field:

if ({billable}=1) then "Yes" else ""

I have another formula called '@test' that also uses the 'billable' field:

if ({billable}=0) then "Yes" else ""

So my data looks something like this:

@paid @test
yes
yes
yes
yes
yes
yes
yes

What I want is a count of these two fields. That is, @paid=4 and @test=3 (counting the yes')

I've tried insert summary, but still no luck. So if there is a solution out there it would be great!

Thanks
 
use a variable as your counter and increment it within your if statement.

ex.

Shared numbervar billableCounter;

if ({billable}=1) then
billableCounter:=billableCounter+1
else
????????
 
sum (not count!) of @billable would give you
the count of paid.

sum of (1 - @billable) would give you a count of unpaid.

Cheers,
- Ido
 
Ido, I am not very familiar with this. Could you expand a little?

Thanks
 
In your sample data, you have four records with
@billable = 1 and three records with @billable = 0

If you simply sum @billable you would get 4,
which is the count of paid.

If you sum 1 - @billable you would get 3,
which is the count of unpaid.

Cheers,
- Ido
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top