Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Exclusion symbol here is '-' . Try:
=Count(DISTINCT{$<[CloseReason] -={CNX}>} %OrderNo)
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
Have you noticed and placed the minus symbol ('-' in red) properly in the set expression?
And don't leave a space between the - and = sign. The exclude operator is -=.
You may try this too
=Count(DISTINCT{$<[CloseReason] = {"*"} - {"CNX"}>} %OrderNo)
OR
=Count({$<[CloseReason] = {"*"}-{CNX}>} DISTINCT %OrderNo)
Set Analysis - Exclude reason code
I've copied and pasted what i have below:
=Count(DISTINCT{$<[CloseReason] -={CNX}>} %OrderNo)
Still only gives me 12 records, not 2665.
Are you sure that there are 2665 DISTINCT records?