September 17, 2007, 02:50 PM
Jose CruzGetting a Count on a Report Field
Can anyone help me get a count on a field that gives me a value of 'Y'(es) for every unique value in another field?
For example, the report lists all vendors that are Located in the U.S. The output I need would look like this:
Vendor# Located in U.S? PO#
12345 Y abc
12345 Y def
67890 N hij
65432 Y klm
89012 Y nop
56789 Y qrs
56789 Y tuv
Total U.S. Vendors: 4
Note: Count is only 4 because vendors #12345 and #56789 are only counted once even though they have multiple PO's.
September 17, 2007, 03:17 PM
ETThis may work for you.
This assumes you are sorting by vendor.
TABLE FILE FILENAME
PRINT USFLAG PO#
COMPUTE USCNT/I4=IF VENDOR NE LAST VENDOR AND USFLAG EQ 'Y' THEN 1 ELSE 0; NOPRINT
BY VENDOR
ON TABLE SUBFOOT
"TOTAL US VENDORS %ST.USCNT"
END
Replace the % above with a left caret
Good Luck
et
September 17, 2007, 03:25 PM
FrankDutchTABLE FILE VENDORS
SUM CNT.DST.VENDOR
WHERE 'Located in US' EQ 'Y';
END
Will give you the number 4.
OR
TABLE FILE VENDORS
SUM CNT.DST.VENDORS
BY 'Located'
END
Will give
Y 4
N 1
and you can als calc the percentage in and out...
September 17, 2007, 03:29 PM
FrankDutchquote:
Originally posted by ET:
Replace the % above with a left caret
E.T.
If you put your coding between
[CODE]
[/CODE]
you can type the normal code characters.
September 18, 2007, 07:46 AM
ETFrank
Thanks for the tip.
et