Tableau - Operations between two tables from different sources and different granularity

时间:2016-10-20 20:11:18

标签: tableau

I'm using tableau Desktop V9.1.13 with two tables from different data sources (one comes from Bigquery and the other from a postgresql DB) and I want to perform a multiplication between two columns of these tables. The first table has one row for a single transaction and the other has one row for each currency available in the database. I've tried blending and create a calculated field but the last always throws an error. The first table looks like this:

+----------------+--------+----------+
| transaction-id | Value  | Currency |
+----------------+--------+----------+
| 123-abc        | 120    | BRL      |
+----------------+--------+----------+
| 556-fds        | 100    | PEN      |
+----------------+--------+----------+
| 456-cde        | 120000 | COP      |
+----------------+--------+----------+
| 789-fgr        | 100    | MXN      |
+----------------+--------+----------+

And the other table

+----------+--------------+
| Currency | Value in USD |
+----------+--------------+
| COP      | 0.0003       |
+----------+--------------+
| BRL      | 0.3169       |
+----------+--------------+
| PEN      | 0.2958       |
+----------+--------------+
| MXN      | 0.0539       |
+----------+--------------+

Now I want to generate a new column called Value_USD that is the product of the transaction amount with the value of its currency.

+----------------+--------+----------+-----------+
| transaction-id | Value  | Currency | Value_USD |
+----------------+--------+----------+-----------+
| 123-abc        | 120    | BRL      |      38   |
+----------------+--------+----------+-----------+
| 556-fds        | 100    | PEN      |      29.58|
+----------------+--------+----------+-----------+
| 456-cde        | 120000 | COP      |      40   |
+----------------+--------+----------+-----------+
| 789-fgr        | 100    | MXN      |      5.39 |
+----------------+--------+----------+-----------+

0 个答案:

没有答案