hellohello1
Technical User
I have a query with 3 fields:
ProjectID (Number)
AsOfDate (Date)
OverallRating(Number)
The AsOfDate is always the last day of the month (ex: 2/28/09, 1/31/09, 12/31/08, etc).
OverallRating is a number from 1 to 7.
I am trying to have a column called ConsecutiveMonths1 that, for the latest month, shows how many consecutive months each project has an OverallRating of 1.
For example:
ProjectID...AsOfDate....OverallRating
2345.........9/30/08.......2
2345.........10/31/08......1
2345.........11/30/08......2
2345.........12/31/08......1
2345.........1/31/08.......1
2345.........2/28/09.......1
Since we are currently in March, the latest month is 2/28/09. So I would want my results to show:
ProjectID...AsOfDate....OverallRating....ConsecutiveMonths1
2345.........2/28/09......1......................3
The ConsecutiveMonths1=3 because the OverallRating was 1 for 3 consecutive months counting backwards from 2/28/09.
Any idea how I could do this?
Thanks,
ProjectID (Number)
AsOfDate (Date)
OverallRating(Number)
The AsOfDate is always the last day of the month (ex: 2/28/09, 1/31/09, 12/31/08, etc).
OverallRating is a number from 1 to 7.
I am trying to have a column called ConsecutiveMonths1 that, for the latest month, shows how many consecutive months each project has an OverallRating of 1.
For example:
ProjectID...AsOfDate....OverallRating
2345.........9/30/08.......2
2345.........10/31/08......1
2345.........11/30/08......2
2345.........12/31/08......1
2345.........1/31/08.......1
2345.........2/28/09.......1
Since we are currently in March, the latest month is 2/28/09. So I would want my results to show:
ProjectID...AsOfDate....OverallRating....ConsecutiveMonths1
2345.........2/28/09......1......................3
The ConsecutiveMonths1=3 because the OverallRating was 1 for 3 consecutive months counting backwards from 2/28/09.
Any idea how I could do this?
Thanks,