M
mr-tom
Hi all,
I'm trying to produce some results over a rolling six months, so e.g.
somebody's total score in Jan 09 is the sum of their scores for Aug 08 to Jan
09; their Feb 09 total score is the sum of their scores for Sept 08 to Feb
09, etc.
Don't worry about year ends, we have a month ID which increments by one each
month, regardless of year (Jan 09 was 300, Dec 08 was 299 etc)
This may be the wrong way to go about it, but I'm trying to generate
something that looks like this (a bit like a crosstab):
Person Jan Score Feb Score Mar Score etc
Tom 6 5 7
Jon 0 1 2
Where the Jan score of 6 is the total of Sept 08 to Jan 09.
We're looking at whole years at a time, so excluding the year name from the
column titles is deliberate as I simply need to update the monthIDs to move
to next year.
There's one more facet. I've decided to store the monthID of the first
month of the current year in a table called tbl_StartDateEndDate as
YearStartMonthID (Jan 09 being 300)
So for Jan, I need all the scores for a person where the corresponding
MonthID is between 300 and (300-5) or in the terms of this query,
[tbl_StartDateEndDate]![YearStartMonthID] and
([tbl_StartDateEndDate]![YearStartMonthID]-5)
To do this, I've created a new query in design view and added the following
tables:
tbl_StartDateEndDate
qry_TCC_Union_Aggregator (where my source data is coming from)
I've then added two fields to the query, the first is the person's ID, the
second is the following expression (which I seem to have messed up):
01 Points: IIf([qry_TCC_Union_Aggregator]![TimeMonthId] Between
[tbl_StartDateEndDate]![YearStartMonthID] And
([tbl_StartDateEndDate]![YearStartMonthID]-5),Sum([qry_TCC_Union_Aggregator]![SumOfSumOfTotalPoints]),0)
(This would create the Jan score - I can worry about the others once I've
got this one working!)
Finally, I've made this a summary query, so group by the person's ID, and (I
guess) set the expression to "expression"...
If you can tell me where I'm going wrong, I'll be very grateful.
Thanks!
Tom.
I'm trying to produce some results over a rolling six months, so e.g.
somebody's total score in Jan 09 is the sum of their scores for Aug 08 to Jan
09; their Feb 09 total score is the sum of their scores for Sept 08 to Feb
09, etc.
Don't worry about year ends, we have a month ID which increments by one each
month, regardless of year (Jan 09 was 300, Dec 08 was 299 etc)
This may be the wrong way to go about it, but I'm trying to generate
something that looks like this (a bit like a crosstab):
Person Jan Score Feb Score Mar Score etc
Tom 6 5 7
Jon 0 1 2
Where the Jan score of 6 is the total of Sept 08 to Jan 09.
We're looking at whole years at a time, so excluding the year name from the
column titles is deliberate as I simply need to update the monthIDs to move
to next year.
There's one more facet. I've decided to store the monthID of the first
month of the current year in a table called tbl_StartDateEndDate as
YearStartMonthID (Jan 09 being 300)
So for Jan, I need all the scores for a person where the corresponding
MonthID is between 300 and (300-5) or in the terms of this query,
[tbl_StartDateEndDate]![YearStartMonthID] and
([tbl_StartDateEndDate]![YearStartMonthID]-5)
To do this, I've created a new query in design view and added the following
tables:
tbl_StartDateEndDate
qry_TCC_Union_Aggregator (where my source data is coming from)
I've then added two fields to the query, the first is the person's ID, the
second is the following expression (which I seem to have messed up):
01 Points: IIf([qry_TCC_Union_Aggregator]![TimeMonthId] Between
[tbl_StartDateEndDate]![YearStartMonthID] And
([tbl_StartDateEndDate]![YearStartMonthID]-5),Sum([qry_TCC_Union_Aggregator]![SumOfSumOfTotalPoints]),0)
(This would create the Jan score - I can worry about the others once I've
got this one working!)
Finally, I've made this a summary query, so group by the person's ID, and (I
guess) set the expression to "expression"...
If you can tell me where I'm going wrong, I'll be very grateful.
Thanks!
Tom.