Hi All,
I need to report how many times we used Promo Code X, Y, or Z for how many of each product A, B, C...
Data-set will contain about 10,000 records each month and whatever solution I find will need to be run on up to 5 Promos per month.
Here is my quandry:
If the current record's 'prod_id' = "107", I need to look at each record where 'invh_no' is same as current record and 'data_field' is equal to current record's ('data_field' * -1.0) and then report a total 'qty' of each 'prod_id' = "107" broken down by the 'prod_desc' from those matching records.
It seems so confusing explained this way but here is some example data and what the results should be:
[TABLE="class: grid, width: 786"]
<colgroup><col width="131" style="width:98pt" span="6"> </colgroup><tbody>[TR]
[TD="width: 131"]invh_date[/TD]
[TD="width: 131"]invh_no[/TD]
[TD="width: 131"]quantity[/TD]
[TD="width: 131"]prod_id[/TD]
[TD="width: 131"]prod_desc[/TD]
[TD="width: 131"]data_field[/TD]
[/TR]
[TR]
[TD="align: right"]7/10/2017[/TD]
[TD]561712[/TD]
[TD="align: right"]4[/TD]
[TD]107[/TD]
[TD]Promo X[/TD]
[TD] -31.95[/TD]
[/TR]
[TR]
[TD="align: right"]7/10/2017[/TD]
[TD]561712[/TD]
[TD="align: right"]1[/TD]
[TD]550[/TD]
[TD]Delivery[/TD]
[TD] 2.45[/TD]
[/TR]
[TR]
[TD="align: right"]7/10/2017[/TD]
[TD]561712[/TD]
[TD="align: right"]8[/TD]
[TD]AAAA[/TD]
[TD]Product A[/TD]
[TD] 31.95[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564131[/TD]
[TD="align: right"]2[/TD]
[TD]107[/TD]
[TD]Promo X[/TD]
[TD] -21.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564131[/TD]
[TD="align: right"]1[/TD]
[TD]550[/TD]
[TD]Delivery[/TD]
[TD] 2.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564131[/TD]
[TD="align: right"]4[/TD]
[TD]BBBB[/TD]
[TD]Product B[/TD]
[TD] 15.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564131[/TD]
[TD="align: right"]4[/TD]
[TD]CCCC[/TD]
[TD]Product C[/TD]
[TD] 21.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564250[/TD]
[TD="align: right"]2[/TD]
[TD]107[/TD]
[TD]Promo X[/TD]
[TD] -30.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564250[/TD]
[TD="align: right"]1[/TD]
[TD]550[/TD]
[TD]Delivery[/TD]
[TD] 2.45[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564250[/TD]
[TD="align: right"]4[/TD]
[TD]DDDD[/TD]
[TD]Product D[/TD]
[TD] 30.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]2[/TD]
[TD]107[/TD]
[TD]Promo X[/TD]
[TD] -16.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]1[/TD]
[TD]550[/TD]
[TD]Delivery[/TD]
[TD] 2.45[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]4[/TD]
[TD]BBBB[/TD]
[TD]Product B[/TD]
[TD] 15.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]1[/TD]
[TD]EEEE[/TD]
[TD]Product E[/TD]
[TD] 45.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]1[/TD]
[TD]FFFF[/TD]
[TD]Product F[/TD]
[TD] 45.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]4[/TD]
[TD]AAAA[/TD]
[TD]Product A[/TD]
[TD] 16.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]1[/TD]
[TD]HHHH[/TD]
[TD]Product H[/TD]
[TD] 30.50[/TD]
[/TR]
</tbody>[/TABLE]
Promo X (107) =
Product A = 6
Product C = 2
Product D = 2
Hope that isn't too terribly vague - Any help would be greatly appreciated...
I need to report how many times we used Promo Code X, Y, or Z for how many of each product A, B, C...
Data-set will contain about 10,000 records each month and whatever solution I find will need to be run on up to 5 Promos per month.
Here is my quandry:
If the current record's 'prod_id' = "107", I need to look at each record where 'invh_no' is same as current record and 'data_field' is equal to current record's ('data_field' * -1.0) and then report a total 'qty' of each 'prod_id' = "107" broken down by the 'prod_desc' from those matching records.
It seems so confusing explained this way but here is some example data and what the results should be:
[TABLE="class: grid, width: 786"]
<colgroup><col width="131" style="width:98pt" span="6"> </colgroup><tbody>[TR]
[TD="width: 131"]invh_date[/TD]
[TD="width: 131"]invh_no[/TD]
[TD="width: 131"]quantity[/TD]
[TD="width: 131"]prod_id[/TD]
[TD="width: 131"]prod_desc[/TD]
[TD="width: 131"]data_field[/TD]
[/TR]
[TR]
[TD="align: right"]7/10/2017[/TD]
[TD]561712[/TD]
[TD="align: right"]4[/TD]
[TD]107[/TD]
[TD]Promo X[/TD]
[TD] -31.95[/TD]
[/TR]
[TR]
[TD="align: right"]7/10/2017[/TD]
[TD]561712[/TD]
[TD="align: right"]1[/TD]
[TD]550[/TD]
[TD]Delivery[/TD]
[TD] 2.45[/TD]
[/TR]
[TR]
[TD="align: right"]7/10/2017[/TD]
[TD]561712[/TD]
[TD="align: right"]8[/TD]
[TD]AAAA[/TD]
[TD]Product A[/TD]
[TD] 31.95[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564131[/TD]
[TD="align: right"]2[/TD]
[TD]107[/TD]
[TD]Promo X[/TD]
[TD] -21.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564131[/TD]
[TD="align: right"]1[/TD]
[TD]550[/TD]
[TD]Delivery[/TD]
[TD] 2.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564131[/TD]
[TD="align: right"]4[/TD]
[TD]BBBB[/TD]
[TD]Product B[/TD]
[TD] 15.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564131[/TD]
[TD="align: right"]4[/TD]
[TD]CCCC[/TD]
[TD]Product C[/TD]
[TD] 21.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564250[/TD]
[TD="align: right"]2[/TD]
[TD]107[/TD]
[TD]Promo X[/TD]
[TD] -30.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564250[/TD]
[TD="align: right"]1[/TD]
[TD]550[/TD]
[TD]Delivery[/TD]
[TD] 2.45[/TD]
[/TR]
[TR]
[TD="align: right"]7/3/2017[/TD]
[TD]564250[/TD]
[TD="align: right"]4[/TD]
[TD]DDDD[/TD]
[TD]Product D[/TD]
[TD] 30.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]2[/TD]
[TD]107[/TD]
[TD]Promo X[/TD]
[TD] -16.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]1[/TD]
[TD]550[/TD]
[TD]Delivery[/TD]
[TD] 2.45[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]4[/TD]
[TD]BBBB[/TD]
[TD]Product B[/TD]
[TD] 15.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]1[/TD]
[TD]EEEE[/TD]
[TD]Product E[/TD]
[TD] 45.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]1[/TD]
[TD]FFFF[/TD]
[TD]Product F[/TD]
[TD] 45.00[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]4[/TD]
[TD]AAAA[/TD]
[TD]Product A[/TD]
[TD] 16.50[/TD]
[/TR]
[TR]
[TD="align: right"]7/19/2017[/TD]
[TD]569703[/TD]
[TD="align: right"]1[/TD]
[TD]HHHH[/TD]
[TD]Product H[/TD]
[TD] 30.50[/TD]
[/TR]
</tbody>[/TABLE]
Promo X (107) =
Product A = 6
Product C = 2
Product D = 2
Hope that isn't too terribly vague - Any help would be greatly appreciated...