Re: This Month vs Last Month

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I would probably normalize the table first:
SELECT DateDiff("m", [EvalDate], Date()) as MthNum,
[Name], [Obedience] as Score, "Obedience" as Area
FROM tblNoNameGiven
UNION ALL
SELECT DateDiff("m", [EvalDate], Date()) as MthNum,
[Name], [Physical], "Physical"
FROM tblNoNameGiven
UNION ALL
SELECT DateDiff("m", [EvalDate], Date()) as MthNum,
[Name], [WorkEthic], "WorkEthic"
FROM tblNoNameGiven;

Then create a crosstab query based on the union query with [Name] (should be
a primary key field, Name is a poor choice for a field name) as the Row
Heading, Area as another Row Heading, "Mth" & MthNum as the Column Heading,
and Average of Score as the Value. Set the Column Headings property to:
Column Headings: "Mth0", "Mth1"
This will create a query with columns for Name, Area, Mth0, Mth1. Mth0 will
be the current month score and Mth1 will be last month.
--
Duane Hookom
MS Access MVP


"RTimberlake" <RTimberlake@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ECFD91DA-8FE2-4845-86FB-F7F00634CBCE@xxxxxxxxxxxxxxxx
> Sorry.
> My report is pulling from a query that combines a table and two other
> queries.
> We are trying to create a database that will be used for monthly
> evaluations
> on the boys in our program. The report is currently being pulled for the
> current month for each boy in our program. Since we are on a rolling
> admissions basis the actual month number is calculated by subtracting the
> number of months between a boys arrival and the current month. So, in any
> given report we may have a boy in month one or a boy in month 16. However,
> the report is being pulled for the current month.
> There are several areas that we are measuring: Obedience, Physical, Work
> Ethic, etc. For each area we need to know if a boys score increased,
> decreased, or stayed the same from last month to this month. I had planned
> on
> using arrows to display the relationship between the scores. The peice
> that I
> am having trouble with is the calculations. I can't figure out how to get
> last months score and this months score on the same report.
>
> Report: [Evaluation]
> Feilds: [EvalDate], [Name], [MonthsInProgram], [Obedience], [Physical],
> [WorkEthic]
>
> Does this clear things up, or have I just muddied the waters even more?
>
>
> "Duane Hookom" wrote:
>
>> Do you have a table structure and sample records you would like to share?
>> You have stated where you want to go but we don't know where you are or
>> what
>> you have for resources.
>>
>> --
>> Duane Hookom
>> MS Access MVP
>> --
>>
>> "RTimberlake" <RTimberlake@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:21600572-0A54-400F-A36A-C9E85597360A@xxxxxxxxxxxxxxxx
>> >I have a report in which I would like to compare last months figures
>> >with
>> > this months figures. I do not want to see the previous months figure. I
>> > only
>> > need to know if the figure increased, decreased, or stayed the same.
>> > Any
>> > suggestions?
>>
>>
>>


.



Relevant Pages

  • RE: union query for report
    ... I have a report with 14 subreports. ... but the enter parameter value for A1aC display 12 times. ... The other 6 are based on 6 union ... I wondered if the problem would be using the query, qYr2ReviewSample, in the ...
    (microsoft.public.access.reports)
  • Re: Sum of numbers
    ... Administrator to come in to insure we have this critical report by April. ... You say the union query 'only shows fields from the first table'. ... Do you mean that you want a multicolumn report with all customers' names ...
    (microsoft.public.access.reports)
  • Re: SQL Select Query Help
    ... I should be approaching this as a union and not trying to ... If I type all the rows (pay or deduction) ... > in the case of your report, there IS no logical relationship - so I had to ... > query in chronological order. ...
    (microsoft.public.sqlserver.programming)
  • RE: Still have hope but need more help. First Question, more to fo
    ... Check Help or google on UNION Queries. ... Perhaps if I knew exactly what a union query ... "Duane Hookom" wrote: ... tell us how you want to show this in a report ...
    (microsoft.public.access.reports)
  • Re: Cross Tab with dynamic date column
    ... How to make the report to grab the additional column and subtract one column ... You can change your Column Heading to relative dates with ... "Oded Dror" wrote: ... I have a cross tab query ...
    (microsoft.public.access.reports)