> ## Documentation Index
> Fetch the complete documentation index at: https://help.peliqan.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Currency conversions

When you have transactions, invoices or bookings in multiple currencies, it’s important to convert these into a single currency before doing aggregations. For example you might want to calculate total revenue per month, with sales being done in multiple currencies.

<Warning>
  The challenge is to convert currencies with the ***exchange rate of the day of the transaction***.
</Warning>

# Step 1: import exchange rates

Go to Connections, and add a connection to one of the currency exchange rates connectors, for example Norway Bank (Norges bank).

This will sync a table into your account with exchange rates:

<img src="https://mintcdn.com/peliqan-9d7f0393/bd3Fc7iE3KLG4a0Y/images/Data%20transformations/Currency%20conversions/1_exchange_rates.png?fit=max&auto=format&n=bd3Fc7iE3KLG4a0Y&q=85&s=642a58e66656a1f0dcba792a4deed834" alt="Exchange rates table" width="3906" height="1454" data-path="images/Data transformations/Currency conversions/1_exchange_rates.png" />

# Step 2: join your transactions with the exchange rates

Write a query that joins your transactions on the currency exchange rates.

* Make sure to perform a LEFT join and ***not*** an INNER JOIN, to make sure that no transactions would be left out because of a missing matching record in the currency exchange table.
* Make sure to join on both the currency ***and*** the date of the transaction.
* Add a column with the converted amount: `transaction amount x rate` from the currencies table

Example query:

```sql theme={null}
SELECT 
	transactions.*,
  transactions.amount * rate AS converted_amount 
FROM transactions
LEFT JOIN currencies
ON transactions.currencycode = rate_currency AND transactions.date = rate_date
```

<img src="https://mintcdn.com/peliqan-9d7f0393/bd3Fc7iE3KLG4a0Y/images/Data%20transformations/Currency%20conversions/2_query.png?fit=max&auto=format&n=bd3Fc7iE3KLG4a0Y&q=85&s=919d0eafa9dc7aa8f464d57db774108d" alt="Query joining transactions with exchange rates" width="3904" height="1594" data-path="images/Data transformations/Currency conversions/2_query.png" />

# Step 3: check the result

Double check if any converted amounts are missing:

<img src="https://mintcdn.com/peliqan-9d7f0393/bd3Fc7iE3KLG4a0Y/images/Data%20transformations/Currency%20conversions/3_converted_amounts.png?fit=max&auto=format&n=bd3Fc7iE3KLG4a0Y&q=85&s=5874a690ee0d639dfd868a386c45670f" alt="Result with converted amounts" width="3890" height="1172" data-path="images/Data transformations/Currency conversions/3_converted_amounts.png" />

If OK, use this table going forward in your aggregations, charts etc.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.