Using multiple lookups in an equation

clintthorn

Registered User.
Local time
Today, 05:28
Joined
Jul 2, 2008
Messages
16
I am tying to generate a query that provides revenue estimates for each log line. I am using two tables: the main data table and another for lookup values.
I want to generate a revenue field that is based off the installs in the main data table. However, this is dependent on two other fields--Country and Month.
The other table's fields consist of Country, Month, and Activation.
I want to multiple the installs from the main data table by the activation rate which has both the same country and month in the activation table.

Any help would be great!
 
clint,

Code:
Select MainTable.Country,
       MainTable.Month,
       MainTable.Installs * RateTable.ActivationRate As TotalCost
From   MainTable Inner Join RateTable On
         MainTable.Country = RateTable.Country And
         MainTable.Month = RateTable.Month

hth,
Wayne
 
I tried that but still couldn't get it to work. It is probably because it is a bit more complicated than what I said. I am using a query to roll up some of the data. I also need to multiple the 'installed' and 'activation rate' by a bounty that is country specific.

Here is my query without the activation table:

SELECT Convert2_Query.Month, Convert2_Query.Date, Convert2_Query.Source, Convert2_Query.Client, Convert2_Query.Product, Convert2_Query.Lang, Convert2_Query.Geo, Convert2_Query.Country, Convert2_Query.OriginalCountry, Convert2_Query.Buckets, Convert2_Query.Distribution, Convert2_Query.MorphedCode, Convert2_Query.Presented, Convert2_Query.Accepted, Convert2_Query.Installed, Convert2_Query.Distcode
FROM Convert2_Query;

I need a formula that would have the essence of the following:

If([product]="x",[installed]*[bounty]*[activation],0)

Activation is in a separate table and also has a month and country field.
 
Forgot to add that when I try to implement what you said earlier, It give me a 'type mismatch in expression' when I join on both country and month
 

Users who are viewing this thread

Back
Top Bottom