Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis - Exclude reason code

Hi all,

I'm new to QV and need help with an expression.

I need to count all the unique order numbers based on the current selection and exclude all cancelled orders.

The order number is stored in the field  [%OrderNo].  [CloseReason] holds the cancelled order flag 'CNX'.

I am currently counting unique orders using:

=Count(DISTINCT %OrderNo)

I was trying something like:

=Count(DISTINCT{$<[CloseReason]<>{CNX}>} %OrderNo) but there is an error.

I could use:

=Count(DISTINCT %OrderNo) - Count(DISTINCT{$<[CloseReason]={CNX}>} %OrderNo)


This works but i'm sure there is a "cleaner" way to do this.


Any advice would be appreciated.

Thanks


7 Replies
tresesco
MVP
MVP

Exclusion symbol here is '-' . Try:

=Count(DISTINCT{$<[CloseReason] -={CNX}>} %OrderNo)

Not applicable
Author

HI Tresesco,

I've just tried that.  I know i have a total of 2680 unique order numbers, of which 15 are with CNX.  This should leave me with 2665 with the excludion.

The expression you have suggested leaves me with a count of 15 and not 2665 (2680-15).

Thanks

Mitesh

tresesco
MVP
MVP

Have you noticed and placed the minus symbol ('-' in red) properly in the set expression?

jonathandienst
Partner - Champion III
Partner - Champion III

And don't leave a space between the - and = sign. The exclude operator is -=.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anil_Babu_Samineni

You may try this too

=Count(DISTINCT{$<[CloseReason] = {"*"} - {"CNX"}>} %OrderNo)


OR


=Count({$<[CloseReason] = {"*"}-{CNX}>} DISTINCT %OrderNo)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

I've copied and pasted what i have below:

=Count(DISTINCT{$<[CloseReason] -={CNX}>} %OrderNo)

Still only gives me 12 records, not 2665.

jonathandienst
Partner - Champion III
Partner - Champion III

Are you sure that there are 2665 DISTINCT records?

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein