Calculated field

Mac1512

Board Regular
Joined
Jul 26, 2011
Messages
58
Hi, Very new to access but thought I was trying to create a simple query!

I have 2 tables
Tble1
IDStoreTYpeVale
11System150
21System1100
31System1150
42System150
53System150
64System1100

<tbody>
</tbody>

<tbody>
</tbody>

Tble2
IDStoreTypeVal
11System245
21System235
32System250
43System260

<tbody>
</tbody>

I am trying to show the difference between the Total of system1 less Total System 2, grouped by store.

Query should be like the below
Tble1Tble2
StoreTYpeValeStoreTypeValCalculatedField
1System13001System280-220
2System1502System2500
3System1503System26010
4System1100-100

<tbody>
</tbody>

When I try to write a query I get duplicated entries see below query
SELECT Tble1.Store, Tble1.Vale, Tble2.Store, Tble2.Val, [Tble1]![Vale]-[Tble2]![Val] AS Expr1
FROM Tble1 INNER JOIN Tble2 ON Tble1.Store = Tble2.Store;

Thanks in advance for any help you can give me
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
I'm learning to, so be gentle. This is probably really bad!!!!


SELECT T1.Store, SUM(T1.System1Val) As S1Val, SUM(T1.System2Val) As S2Val, S2Val - S1Val As Variance
FROM (SELECT Tble1.Store, Tble1.Val As System1Val, 0 As System2Val
FROM Tble1
UNION ALL
SELECT Tble2.Store, 0 As System1Val, Tble2.Val As System2Val
FROM Tble2) As T1
GROUP By T1.Store
 
Upvote 0

Forum statistics

Threads
1,221,848
Messages
6,162,406
Members
451,762
Latest member
Brainsanquine

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top