# Power BI Exchange Rates: An Update To Multiple Currencies Management

There are many instances with financial analysis wherein we need to integrate exchange rates, and we can do this easily in Power BI. You may watch the full video of this tutorial at the bottom of this blog.

I have actually shown an example of how to do this using the LOOKUPVALUE function in Power BI.

However, I found one slight issue with the particular function that I went through in the initial video that I didn’t realize at the time.

The problem was that the exchange rate table did not have any exchange rates listed on the weekend, but we did sell goods on the weekend.

What was happening was that the amount sold was being divided by a blank number. As a result, we were getting this infinity result, which was because there was basically no result to showcase.

So what we needed to do was something slightly more advanced in our DAX formula.

We have to actually normalize the exchange rate. Whatever the result was in the table for the Friday, we need to copy that to Saturday and Sunday.

We must re-enact that inside of Power BI with our formula and in this tutorial, I run through how you do that.

But, before we get into the updated formula, we will first review how we handle exchange rates and multiple currencies in Power BI using the LOOKUPVALUE function.

Table of Contents

## Handling Multiple Currencies Using LOOKUPVALUE

We put the LOOKUPVALUE function inside an iterating function, which is SUMX.

Here, we want to sum up the revenue, but we adjust every single row in the Sales Data table. This way, we have the associated exchange rates for each sale.

The LOOKUPVALUE  function does is literally “look up” the value for the particular exchange rate on specific dates and other relevant information for your SUMX calculation.

In this formula, every single sale will be adjusted for the currency rate on that particular date.

## Flaw In The LOOKUPVALUE Formula

The formula with LOOKUPVALUE is not actually bad. The only problem with it is that there was no currency exchange rate on the weekends.

On the first glance, we would not notice it when we look at the historic data. It would appear that every single day has a currency exchange rate.

However, when we look closer, the weekends are actually missing. This means that the result of the calculation is not accurate.

The solution is to set a number on the weekend. And to do this, we use the Friday number and drag it over Saturday and Sunday because currencies don’t trade on a weekend.

## Handling Multiple Currencies Using LASTNONBLANK

To achieve the solution to the missing weekend number, we need to create a new formula that extends the Friday number over Saturday and Sunday.

Here’s the formula:

This formula, which I called Exchange Rate Normalized, uses a variable (VAR) with FILTER (RevisedDates) that is incorporated into CALCULATE with the LASTNONBLANK function.

The LASTNONBLANK looks into the last exchange rate in a RevisedDates table, which we used in combination with the FILTER function.

The RevisedDates table looks back at three days, and then grabs the last exchange rate that exists on those days.

We can then integrate this Exchange Rate Normalized formula into our Total Sales Ccy Adj. formula, simplifying it.

This is how your data looks like with the updated Total Sales Ccy Adj. formula with the Exchange Rate Normalized that extends Friday over the weekend:

## Conclusion

This blog discusses the updated formula for handling multiple currencies in Power BI.

Instead of using the LOOKUPVALUE, we use the LASTNONBLANK function in a separate formula, Exchange Rate Normalized, which is then incorporated to our calculation for Total Sales Ccy Adj.

Coming up with this formula was not easy, but it’s a very powerful tool for your calculations.

Thereâ€™s a little bit to it from a DAX perspective. However, if you can get your head around how this works, especially the LASTNONBLANK function, then there are many implications of similar techniques across many analytical scenarios you might find yourself having to analyze on a day-to-day basis.

Cheers,

Sam

## Gestalt Principles: Understanding Its Importance In Report Design

The aim of the Gestalt principles of design is to understand how humans typically gain meaningful...

## Power Query: How To Quickly Add Notes

In this post, weâ€™ll learn different ways to add notes in Power Query, which can benefit the people who...

## How To Sort & Filter Chart In Report Builder

In this tutorial, youâ€™ll learn how to sort and filter data in a chart in Report Builder. This tutorial...

## Power BI Filtering Techniques For Tables

In this blog, weâ€™re going to learn about some essential Power BI filtering techniques for tables. We'll...

## Calculating Weekly Sales w/DAX In Power BI

Calculating the difference between weekly sales results in Power BI is unfortunately not that easy. You...

## Three Ways To Use R Script In Power BI

How to Use R In Power BI There are three ways that R can talk to Power BI. This tutorial will teach you...

## Creating Dynamic Ranking Tables Using RANKX In Power BI

In this tutorial, weâ€™ll look at a unique technique inside Power BI that allows us to create dynamic...

## Introduction To Creating An SSRS Bar Chart

Bar charts are a popular way of visualizing data and are often used to compare data across different...

## Find Top Customers Using RANKX In Power BI

Power BI is an amazing analytical engine! In this blog post, I'm going to show you how you can find...

## Power Query Editor: Staging Queries

In this tutorial, we'll learn aboutÂ staging queries using Power Query editor.Â ThisÂ isÂ aÂ new...

## Running Totals In Power BI Using DAX

Sometimes calculating running totals in Power BI is a far better away to analyse trends than just...

## Selenium IDE In Power Automate UI Flows

In this tutorial, we'll discuss the Selenium IDE option in Power Automate UI flows. When creating UI...