PC Review


Reply
Thread Tools Rate Thread

Calculate Difference

 
 
=?Utf-8?B?enl1cw==?=
Guest
Posts: n/a
 
      9th Nov 2007
I hv table and sample data as below

Mth Prod Amt
Jan A 100
Jan B 150
Feb A 200
Feb B 100

When i do a report i've sorted & grouped based on 1) prod and 2)mth where i
create group header. My report will look like this

Prod A Jan 100
Feb 200

Prod B Jan 150
Feb 100

Q..How do i calculate variance for Feb & Jan by product and probably my
report will look like this


Prod A Jan 100
Feb 200
Var 100

Prod B Jan 150
Feb 100
Var -50

Appreciate your help.


 
Reply With Quote
 
 
 
 
Stefan Hoffmann
Guest
Posts: n/a
 
      9th Nov 2007
hi,

zyus wrote:
> Q..How do i calculate variance for Feb & Jan by product and probably my
> report will look like this

Create a grouped query and use the Var() aggregation, something like

SELECT
[Product],
[Month],
Var([Price])
FROM
[yourTable]
GROUP BY
[Product],
[Month]



mfG
--> stefan <--
 
Reply With Quote
 
=?Utf-8?B?enl1cw==?=
Guest
Posts: n/a
 
      12th Nov 2007
I tried with this SQL but returned 0 for the variance

SELECT [Tbl-VAR].Product, [Tbl-VAR].Mth, Var([Tbl-VAR].Amt) AS VarOfAmt
FROM [Tbl-VAR]
GROUP BY [Tbl-VAR].Product, [Tbl-VAR].Mth;

My sample table (Tbl-VAR) are as follow :

Product Mth Amt
P Jan 100
K Jan 500
P Feb 250
K Feb 200


TQ

"Stefan Hoffmann" wrote:

> hi,
>
> zyus wrote:
> > Q..How do i calculate variance for Feb & Jan by product and probably my
> > report will look like this

> Create a grouped query and use the Var() aggregation, something like
>
> SELECT
> [Product],
> [Month],
> Var([Price])
> FROM
> [yourTable]
> GROUP BY
> [Product],
> [Month]
>
>
>
> mfG
> --> stefan <--
>

 
Reply With Quote
 
Stefan Hoffmann
Guest
Posts: n/a
 
      12th Nov 2007
hi,

zyus wrote:
> I tried with this SQL but returned 0 for the variance
>
> SELECT [Tbl-VAR].Product, [Tbl-VAR].Mth, Var([Tbl-VAR].Amt) AS VarOfAmt
> FROM [Tbl-VAR]
> GROUP BY [Tbl-VAR].Product, [Tbl-VAR].Mth;
>
> Product Mth Amt
> P Jan 100
> K Jan 500
> P Feb 250
> K Feb 200

The Variance can only be calculated if there is more than one value per
aggregation, e.g. with our data you can only the variance per year
(drop the group by month.



mfG
--> stefan <--

 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      12th Nov 2007
On Mon, 12 Nov 2007 14:06:12 +0100, Stefan Hoffmann
<(E-Mail Removed)> wrote:

>hi,
>
>zyus wrote:
>> I tried with this SQL but returned 0 for the variance
>>
>> SELECT [Tbl-VAR].Product, [Tbl-VAR].Mth, Var([Tbl-VAR].Amt) AS VarOfAmt
>> FROM [Tbl-VAR]
>> GROUP BY [Tbl-VAR].Product, [Tbl-VAR].Mth;
>>
>> Product Mth Amt
>> P Jan 100
>> K Jan 500
>> P Feb 250
>> K Feb 200

>The Variance can only be calculated if there is more than one value per
> aggregation, e.g. with our data you can only the variance per year
>(drop the group by month.
>
>
>
>mfG
>--> stefan <--


I think Zyus is using "variance" to just mean the change from month to month,
not the statistical measure.

John W. Vinson [MVP]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate Difference zyus Microsoft Access 1 10th Jun 2008 08:43 AM
How can I calculate difference value =?Utf-8?B?Tm92YQ==?= Microsoft Access Queries 6 11th Jan 2006 05:56 AM
Calculate date difference. Charles Harris Microsoft Access Getting Started 1 15th Nov 2004 01:58 PM
calculate % of difference vwhite@lci-sigwks.com Microsoft Excel Worksheet Functions 2 26th May 2004 07:28 PM
To Calculate Difference =?Utf-8?B?QWlzaGE=?= Microsoft Access Reports 1 10th Mar 2004 12:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 PM.