×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Need To Total (& subtotal) Unique Numbers

## Need To Total (& subtotal) Unique Numbers

(OP)
My database is a compilation of line items that create an invoice.

In each line of the invoice I have a field  "order number". This field will appear in every line of an invoice. (This means the same number may appear many times in an invoice).

The same "order number" may appear in more than one invoice. (For instance an item may be backordered and subsequently shipped the next day).

I need to be able to total the UNIQUE number of orders (order numbers).

### RE: Need To Total (& subtotal) Unique Numbers

You didn't say if you want those per invoice or per total lineItem, nor if it is the quantity or the amount.

Make a self join relationship on Order Number.
Make a calc : Sum (SjRelationship::Amount) will give you the total amount.
A Count, based upon the ame relationship, will give ou the quantity.

If you want them per invoice, make a combiKey from the invoicenumber and the ordernumber.
Use that value for the self join.

HTH

### RE: Need To Total (& subtotal) Unique Numbers

(OP)
I am sorry if I am not clear. What I need to calculate is how many orders I am processing. For instance, if an order 5-lines to it, the order number will appear in my database 5-times. I need to calculate this to get an answer of one order.

### RE: Need To Total (& subtotal) Unique Numbers

The Count on Selfjoin on ordernumber will give you the ordernumbers, Count on Selfjoin on combi ordernumber/invoicenumber will give you the ordernumbers per invoice.

### RE: Need To Total (& subtotal) Unique Numbers

(OP)

I am not familiar with "sefjoin" nor can I find it in filemaker's "help". Can you please point me in the right direction. Thanks you.

### RE: Need To Total (& subtotal) Unique Numbers

There's no standard term for this aspect of relationships. You'll hear the terms self-relationship, self-join and same-file relatiinship.
It merely means that a relatiinship is used to relate the file/table to itself.

Be careful.
When using same-file or self-join relationships, it is important to understand how to use the checkbox options in the edit relationship dialog.
The checkbox allows you to delete related records.
Never check this box when using a selfjoin relationship.
It will create the effectr of cascading deletes and delete all the records in the given file.....

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!