gjsaturday
Technical User
TB1
id date fbal fsales
1 02/13/2005 38 0
1 02/14/2005 42 -16
1 02/15/2005 34 -8
1 02/16/2005 48 -10
1 02/17/2005 35 -13
1 02/18/2005 37 -21
1 02/19/2005 43 -13
2 02/13/2005 32 0
2 02/14/2005 29 -3
2 02/15/2005 28 -1
2 02/16/2005 50 -6
2 02/17/2005 43 -7
2 02/18/2005 27 -16
2 02/19/2005 30 -6
TB2
id date abal asales
1 02/13/2005 35 0
1 02/14/2005 43 -15
1 02/15/2005 40 -3
1 02/16/2005 41 -17
1 02/17/2005 0 -19
1 02/18/2005 23 -18
1 02/19/2005 31 -28
2 02/13/2005 39 0
2 02/14/2005 34 -5
2 02/15/2005 29 -5
2 02/16/2005 53 -4
2 02/17/2005 45 -8
2 02/18/2005 22 -23
2 02/19/2005 35 0
I want the following...
id avg(fbal) avg(abal) avg(fsales) avg(asales)
1 40 36 -13 -17
2 34 37 -7 -9
I need the avg calculated based on days where the amount is not zero, but don't know when that will be. FYI, these tables are actually on one table differentiated by a type (a versus f). I'm running into an issue in that these "amounts" are already the sum of 10 different "items" so I can't use the AVG function in that it divides by 70 (10 items for 7 days) (of course, I've also tried multiplying my AVG result by 10 to eliminate that piece)....
I think this is hopeless, but thought I'd put it out here for all you experts.
Thanks in advance!
id date fbal fsales
1 02/13/2005 38 0
1 02/14/2005 42 -16
1 02/15/2005 34 -8
1 02/16/2005 48 -10
1 02/17/2005 35 -13
1 02/18/2005 37 -21
1 02/19/2005 43 -13
2 02/13/2005 32 0
2 02/14/2005 29 -3
2 02/15/2005 28 -1
2 02/16/2005 50 -6
2 02/17/2005 43 -7
2 02/18/2005 27 -16
2 02/19/2005 30 -6
TB2
id date abal asales
1 02/13/2005 35 0
1 02/14/2005 43 -15
1 02/15/2005 40 -3
1 02/16/2005 41 -17
1 02/17/2005 0 -19
1 02/18/2005 23 -18
1 02/19/2005 31 -28
2 02/13/2005 39 0
2 02/14/2005 34 -5
2 02/15/2005 29 -5
2 02/16/2005 53 -4
2 02/17/2005 45 -8
2 02/18/2005 22 -23
2 02/19/2005 35 0
I want the following...
id avg(fbal) avg(abal) avg(fsales) avg(asales)
1 40 36 -13 -17
2 34 37 -7 -9
I need the avg calculated based on days where the amount is not zero, but don't know when that will be. FYI, these tables are actually on one table differentiated by a type (a versus f). I'm running into an issue in that these "amounts" are already the sum of 10 different "items" so I can't use the AVG function in that it divides by 70 (10 items for 7 days) (of course, I've also tried multiplying my AVG result by 10 to eliminate that piece)....
I think this is hopeless, but thought I'd put it out here for all you experts.
Thanks in advance!