Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

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

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I just want to say how much I value your site. I hope the good work keeps up there. It's really helped me..."

Geography

Where in the world do Tek-Tips members come from?
grchang (Programmer)
7 Jun 12 14:41
Hi All,

I need help on the syntex for example below.

Contract # Tier Price
12345 1 3
12345 2 2
12345 3 5
22345 1 6
22345 2 4
33333 -1

I want to have a formula that gives me the price for the highest tier for each of the contract and if the contract has -1 in tier then give me the price at 0. Therefore, from the sample above, my result of this formula will provide me contract #12345 @ price of 5; contract #22345 @ price of 4 and contract #33333 @ price 0.

Anyone? Thank you


PGAC (Programmer)
22 Jun 12 14:10
Hi grchang,


I think you might get the results from a query.

Create a new query and select the table where your data is held.

Select fields Contract then in manually create the following calculated field:

PriceA: Iif([Tier] = -1, 0, [Price])

If the Tier is -1 then the Iif returns 0 otherwise it returns the actual price. An Iif statement may slow down a query's performance if there are a large number of records.

In the query builder, click on the totals button. Set Contract Total to 'Group By' and PriceA Total as 'Max'.

This should give you the max price for each contract number.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close