Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jorgen_santberg
Contributor III
Contributor III

Linking two files to exclude duties from revenue

Hi,

I am having an issue linking two different sources of data.

I have my salesdata in one table:

Table1:

LOAD

    Invoicedate,

     Monthstart(Invoicedate) as Time,

     ArtID,

     Revenue

and data regarding duties in another table:

Table2:

LOAD

     ArtID,

     Year,

     Duty

In my salesdata the revenue includes duties, but I needto see revenues without duties. The duties change over the years and differ per ArtID.

1 Solution

Accepted Solutions
Colin-Albert

Use a mapping table to bring the Duty values into Table 1 with a key that combines the ArtID & year.

Oops - Mapping Load is missing!  Check when copying scripts  - Doh!

Duty_Map:

MAPPING LOAD

     ArtID & '|' &  Year,

     Duty

from XXXX

Table1:

LOAD

    Invoicedate,

     Monthstart(Invoicedate) as Time,

     ArtID,

     applymap('Duty_Map', ArtID & '|' &  year(Invoicedate), 'N/A') as Duty,

     Revenue

from YYYY

View solution in original post

5 Replies
Anil_Babu_Samineni

May be this?

Table2:

LOAD

     ArtID,

     Year,

     Duty;

Table1:

LOAD

    Invoicedate,

     Monthstart(Invoicedate) as Time,

     ArtID,

     Revenue From SalesTable Where Not Exists (Duty, Revenue);

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Colin-Albert

Use a mapping table to bring the Duty values into Table 1 with a key that combines the ArtID & year.

Duty_Map:

LOAD

     ArtID & '!' &  Year,

     Duty

from XXXX

Table1:

LOAD

    Invoicedate,

     Monthstart(Invoicedate) as Time,

     ArtID,

     applymap('Duty_Map, 'ArtID & '!' &  year(Invoicedate), 'N/A') as Duty,

     Revenue

from YYYY

Colin-Albert

Typo - the apply map line should be

applymap('Duty_Map', ArtID & '!' &  year(Invoicedate), 'N/A') as Duty,

Colin-Albert

Use a mapping table to bring the Duty values into Table 1 with a key that combines the ArtID & year.

Oops - Mapping Load is missing!  Check when copying scripts  - Doh!

Duty_Map:

MAPPING LOAD

     ArtID & '|' &  Year,

     Duty

from XXXX

Table1:

LOAD

    Invoicedate,

     Monthstart(Invoicedate) as Time,

     ArtID,

     applymap('Duty_Map', ArtID & '|' &  year(Invoicedate), 'N/A') as Duty,

     Revenue

from YYYY

jorgen_santberg
Contributor III
Contributor III
Author

It works, thanks!