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

Distinct Count Formula

Status
Not open for further replies.

dannyb29

Technical User
Nov 10, 2010
90
GB
Hi All,

This should be so simple but i cannot for the life of me get this Crystal formual to work.

DistinctCount ({AVBTransactionLog.TxnId},{Users.LoginName}) where {AVBRecordTypes.Description}= "End of Shift"

Please help if you can x
 
dunno, it is early still. off the top of my head without crystal nearby, how about:

IF {AVBRecordTypes.Description}= "End of Shift"
THEN DistinctCount ({AVBTransactionLog.TxnId},{Users.LoginName})
 
You would have to set up a formula like this:

if {AVBRecordTypes.Description}= "End of Shift" then
{AVBTransactionLog.TxnId} else
{@null}


...where {@null} is a new formula that you open and close without entering anything. If the TxnID is a number, wrap {@null} in tonumber().

You can then insert a distinctcount on this formula at whatever level you wish.

-LB

 
Hi LB,

I have used this formula for a number of different thigs within the same report which is great!
Is there a way of stating more than one product code.

What i have below works just fine.

if {AVBRecordTypes.Description}= "Top-Off Order from AVB" and {AVBTransactionLogDetails.ProductCode}= 99082 then
{AVBTransactionLog.TxnId} else
{@null}

What i would like to work but doesnt is this:

if {AVBRecordTypes.Description}= "Top-Off Order from AVB" and {AVBTransactionLogDetails.ProductCode}= 99082 or 99079 then
{AVBTransactionLog.TxnId} else
{@null}

"or 99079" throws up errors. Am I missing something or should it work?

Many Thanks
 
you need to set the OR apart using parenthesis:

if {AVBRecordTypes.Description}= "Top-Off Order from AVB" and

(
{AVBTransactionLogDetails.ProductCode}= 99082 or {AVBTransactionLogDetails.ProductCode}= 99079
)

then
{AVBTransactionLog.TxnId} else
{@null}
 
OR,

if {AVBRecordTypes.Description}= "Top-Off Order from AVB" and
{AVBTransactionLogDetails.ProductCode} in [99082, 99079] then
{AVBTransactionLog.TxnId} else
{@null}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top