H
Howard
I have a table containing (amongst other things) a person id, a date and
a score (an integer value from -4 to +4).
First I want to total the score for each person for each week. Maybe
some sort of group by?
Then the hard part. I want to count for how many consecutive weeks -
from today backwards - their weekly total has remained either negative
or positive and which it was. I want a report at the end so don't mind
if its done in a report rather than a query.
ie if sombody had these weekly totals
last week -2
week before -3
before that -2
before that +2
before that 0
they would get Negative 3 as they have had three weeks in a row (up to
today) with negative scores
sombody with
last week +2
week before -3
before that -2
before that +2
before that 0
would get Positive 1 as from today they have only had one week on the
run that is positive
There is no limit to the number of consecutive weeks that might all have
positive or negative totals. The counting of consective weeks stops
when, from today backwards, they change from a positive to negative
total or vice versa or have a total of zero at some point.
This has got me stumped!
Howard
a score (an integer value from -4 to +4).
First I want to total the score for each person for each week. Maybe
some sort of group by?
Then the hard part. I want to count for how many consecutive weeks -
from today backwards - their weekly total has remained either negative
or positive and which it was. I want a report at the end so don't mind
if its done in a report rather than a query.
ie if sombody had these weekly totals
last week -2
week before -3
before that -2
before that +2
before that 0
they would get Negative 3 as they have had three weeks in a row (up to
today) with negative scores
sombody with
last week +2
week before -3
before that -2
before that +2
before that 0
would get Positive 1 as from today they have only had one week on the
run that is positive
There is no limit to the number of consecutive weeks that might all have
positive or negative totals. The counting of consective weeks stops
when, from today backwards, they change from a positive to negative
total or vice versa or have a total of zero at some point.
This has got me stumped!
Howard