sirtemplar Posted April 25, 2007 Posted April 25, 2007 hi again. need help. i have a database with 2 tables. they are related with a field called year. on table1 i have a field with number values. the least/minimum value is 1500. what i want to do is to create in table 2 a field that will contain the sum of data with 1500 on field 1. thank you. :)
Inky Phil Posted April 25, 2007 Posted April 25, 2007 It is not quite clear exactly what you want but the following may help 1/ In Table 2 Establish a relationship between a global field and field 1 (remember to use a global field of the same type as field 1) 2/ Enter 1500 into the global field 3/ Create a calc field (result number) using one of the following a/ Sum(newrelationship::anynumberfield) will give you the sum total of the data in any number field for the records that have 1500 in field1 4/ Count(newrelationship::anyfield) will give you the number of records that have an entry in any field where the record has 1500 in field 1 HTH Phil
sirtemplar Posted April 25, 2007 Author Posted April 25, 2007 thanks for the reply. anyway it did not work. maybe I was not so clear. the field in table 1 which contains 1500 is a result of a calculation. when i put a relationship on field with 1500 in table 1 and the global number field in table 2 i lose the year relationship! so i created a new table relationship i tried the calculation you wrote. the SUM gave me the total of the field with 1500 and the COUNT gave me the total number of entries in that field. i will try to explain more: in table1 i have a calculated number field with 1500 as the minimum result value. sometime it will happen that i get 4,5,6 etc. entries with 1500 on them. the others may be more. now what i want to count and put into a new field on table 2 are the sum of entries with 1500. For example if there are 5 with 1500 the field on table to must give me 7500 if 4, 6000 etc. i hope i am clearer now. thanks.
comment Posted April 25, 2007 Posted April 25, 2007 It would be much easier if you used real names for the tables and fields - we are not computers here, you know. I can't even explain what I mean with names like that, so I'll restate your problem like this: Table Data: - Yearfield - Numberfield Table Viewer: - Yearfield Now, it seems you need a calculation field cMin in the Viewer table = Min ( Data::Numberfield ) Next, set up a relationship between Viewer and a new occurence of Data: Viewer::Yearfield = Data 2::Yearfield AND Viewer::cMin = Data 2::Numberfield Finally, a calculation field in Viewer = Sum ( Data 2::Numberfield ) will give you the sum of entries that are at minimum value for that year.
Recommended Posts
This topic is 6483 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now