Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum values in two tables

Hi,

I have tried to do this on my own but keep coming across errors and problems:

I have 2 tables relating to a number of invoices.....

one SQL table - called DataSet: (contains fields LineAmount and CurrencyCode) - The invoice table.

one XL table - called FXRates: (contains fields CurrencyCode and FXRate) - The FX table.

In my Load Script I would like to create a new field for each Invoice called DollarAmount that is the product of LineAmount * FXRate based on the correct CurrencyCode

Any help would be greatly appreciated, I've tried Joins and Speedmaps, but to no avail!

Thanks,

Michael

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

There sometimes can be a issue with the single left join so when loading the data to create a temp table. Then reload this resident table multiplying LineAmount*FXRate. Drop the TempTable

Inv_Det_temp:

LOAD

Invoice_no,

Product,

LineAmount,

CurrencyCode;

SQL SELECT *

FROM inv.detail;

Left join(Inv_Det)

LOAD

CurrencyCode,

FXRate;

SQL SELECT *

FROM currency.detail;

Inv_Det:

LOAD

Invoice_no,

Product,

Line_Amt,

CurrencyCode,

FXRate,

LineAmount* FXRate as ActualAmount

RESIDENT Inv_Det_temp;

Drop table Inv_Det_temp

View solution in original post

4 Replies
ipauldur
Creator
Creator

Hi,

You can do the left join of excel table with SQl table using currency code field.

Then, you can derive the ne w field.There is no difficulties...

What error you are getting?

Regards,

Durai.

Not applicable
Author

There sometimes can be a issue with the single left join so when loading the data to create a temp table. Then reload this resident table multiplying LineAmount*FXRate. Drop the TempTable

Inv_Det_temp:

LOAD

Invoice_no,

Product,

LineAmount,

CurrencyCode;

SQL SELECT *

FROM inv.detail;

Left join(Inv_Det)

LOAD

CurrencyCode,

FXRate;

SQL SELECT *

FROM currency.detail;

Inv_Det:

LOAD

Invoice_no,

Product,

Line_Amt,

CurrencyCode,

FXRate,

LineAmount* FXRate as ActualAmount

RESIDENT Inv_Det_temp;

Drop table Inv_Det_temp

Not applicable
Author

There sometimes can be a issue with the single left join so when loading the data to create a temp table. Then reload this resident table multiplying LineAmount*FXRate. Drop the TempTable

Inv_Det_temp:

LOAD

Invoice_no,

Product,

LineAmount,

CurrencyCode;

SQL SELECT *

FROM inv.detail;

Left join(Inv_Det)

LOAD

CurrencyCode,

FXRate;

SQL SELECT *

FROM currency.detail;

Inv_Det:

LOAD

Invoice_no,

Product,

Line_Amt,

CurrencyCode,

FXRate,

LineAmount* FXRate as ActualAmount

RESIDENT Inv_Det_temp;

Drop table Inv_Det_temp

Not applicable
Author

Excellent, thanks Carney!