Forum

How get column valu...
 
Notifications
Clear all

How get column value from another query based on current query column value?

3 Posts
3 Users
0 Reactions
173 Views
(@zchase)
Posts: 18
Eminent Member
Topic starter
 

One query contains currency and exchange rate with reference to USD currency.

Another query contains transacted amount in native currency and i need to calculate the amount in USD currency.

For example,

Query 1

Currency Exchrate

SGD 1.3683

 

Query 2

Currency Amount USD Amt

SGD 341 ____

 
Posted : 31/08/2020 6:52 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Francis,

Always best to provide your workbook and data so we don't have to recreate everything from scratch.

If your conversion rate is the output of another query then you can create a custom column and use the rate by referring to the name of the query.  For example;

#"Added Custom" = Table.AddColumn(#"Changed Type", "USD", each [SGD] * USDRate)

takes the values in the column SGD and multiplies them by the output (the exchange rate) of the query USDRate, resulting in a new column called USD.

You can also create a custom function and either hold the exchange rate in that, or read the rate from a cell.

Then by invoking the custom function and multiplying the rate by the SGD, you'll get the same results.

In the attached file I've included examples of both methods.

Regards

Phil

 
Posted : 31/08/2020 7:31 pm
(@bluesky63)
Posts: 162
Estimable Member
 

Hi Francis

Attached a simple solution

first query,  Data>New query>from other sources > From Web,   input https://www.xe.com/currencytables/?from=USD,     or if you have the currency table just bring in to Power Query Editor

2nd query is to bring in the input amount

then merge with the currency table to get the daily conversion for SGD to USD 

just output the converted USD back to Excel

The macro is good to have (save some steps of right click refresh)

you can try input amount in A2 and click Convert

 
Posted : 01/09/2020 3:22 am
Share: