Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello Experts
I have a append query with 3 columns.
the fields in the append query are Date, Rate, Curr (for Currency).
I have 4 different currencies: USD, EUR, GBP, DKK
What I need is to add a column called [USD Amount] in my query called Stampli and this column will lookup the rate based on 3 criteria: Stampli.[WDDate] and the Stampli.[Currency] but if the currency is USD then use the Stampli.[Amount] (since this is already in USD or could simply use 1 in the calculation for what te currency is USD.
Example: if Stampli.[WDDate] is 1/26/25 and Stampli.[Currency] = EUR then calcuate the Amount*Rate but noting that if USD then use a 1 as the Rate.
The rate would be the rate according to that Stampli.[WDDate] and Stampli.[Currency]
Not sure if I am missing something in my explanation.
I am a novice user of PQ.
thank you very much.
here is a clip of what the Append query looks like:
The lookup formula would lookup the rate in this query.
Solved! Go to Solution.
hi @Centaur1 ,
Here's the concise Power Query M code to calculate USD Amount:
let
// Load queries
Stampli = YourStampliTable,
CurrencyRates = YourCurrencyRateTable,
// Merge Stampli with CurrencyRates
MergedTable = Table.NestedJoin(Stampli, {"WDDate", "Currency"}, CurrencyRates, {"Date", "Curr"}, "MergedRates", JoinKind.LeftOuter),
// Expand the Rate column
ExpandedTable = Table.ExpandTableColumn(MergedTable, "MergedRates", {"Rate"}),
// Add USD Amount column
AddUSDColumn = Table.AddColumn(ExpandedTable, "USD Amount", each if [Currency] = "USD" then [Amount] else [Amount] * [Rate], type number)
in
AddUSDColumn
hi @Centaur1 ,
Here's the concise Power Query M code to calculate USD Amount:
let
// Load queries
Stampli = YourStampliTable,
CurrencyRates = YourCurrencyRateTable,
// Merge Stampli with CurrencyRates
MergedTable = Table.NestedJoin(Stampli, {"WDDate", "Currency"}, CurrencyRates, {"Date", "Curr"}, "MergedRates", JoinKind.LeftOuter),
// Expand the Rate column
ExpandedTable = Table.ExpandTableColumn(MergedTable, "MergedRates", {"Rate"}),
// Add USD Amount column
AddUSDColumn = Table.AddColumn(ExpandedTable, "USD Amount", each if [Currency] = "USD" then [Amount] else [Amount] * [Rate], type number)
in
AddUSDColumn
Hi Rohit. that worked! thank you very much.
Hi @Centaur1, again:
Provide sample data in usable format (not as a screenshot) - if you don't know how - read note below my post.
Don't forget to provide also expected result based on sample data.
Hi ,
Merge the Stampli table with the Rates table using WDDate and Currency to get the corresponding Rate.
Add a conditional column to calculate [USD Amount]: if Currency = USD, use Amount, otherwise multiply Amount by Rate.
Expand the Rate column from the Rates table.
If this helps please do give a kudos and accept this as a solution
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 17 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |