I have orders that contain varying number of items. The majority of the items will have the same quantity, that is the number I am interested in for each order. So I group by order and do a running total with Nth most frequent with N = 1. Now there are various types of orders and I need a sum of the most frequent quantity by order type. But since it is not possible to have a running total of another running total field how can I go about doing this? Any help would be appreciated.
So what I need is for it to come up with:
T1 = 13
T2 = 100
Code:
Example:
ORDER# ITEM QTY TYPE
111111 AAAA 5 T1
111111 BBBB 5 T1
111111 CCCC 1 T1
111111 DDDD 5 T1
222222 GGGG 3 T1
222222 ZZZZ 8 T1
222222 QQQQ 8 T1
333333 TTTT 100 T2
333333 SSSS 100 T2
T1 = 13
T2 = 100