Jump to content

How can I calculate a column based on data from two different data tables


Byron Kelly

Recommended Posts

Hello

 

I am trying to do some basic math on two different data sets.

I have one data table that has oil productionnumbers per year for a list of companies.

I have a second data table that has cost per year for the same set of companies.

The data tables are related by the company name (ID #).

 

I would like to divide the cost per year by the production per year for each company.

In my mind, this simple math would be: Cost per bbl of production = Cost per year ( data table 2) / Production per year (data table 1) .

This seems like a simple thing to do but I cant figure out how to insert a calculated colum using metrics from two different data tables. Can somebody give me a hand

 

Thanks

Link to comment
Share on other sites

Ok. Is there a walk through on how to do this I am having trouble matching colums when inserting the data from one data table into another. For example, I have a colume that is company name by ID number, but the two data tables have a different number of entries into this company name ID column. Is there a way to match on common values only 
Link to comment
Share on other sites

So I should start with the data set that has the most records then I guess, and add the data to that data set. In general, for plotting data, is it better to have a single data table that is a composite of multiple data tables, or to have individual data tables that are connected via a relationship on a matching column  
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...