# 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.

## 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

Sam McKay, CFA
Sam is Enterprise DNA's CEO & Founder. He helps individuals and organizations develop data driven cultures and create enterprise value by delivering business intelligence training and education.

## Power BI Between Dates Working Hours Solution

In todayâ€™s blog, I will demonstrate an approach to Access Analyticâ€™s Start Stop Challenge where, using...

## Building Your Data Model Relationships In Power BI

In today's tutorial, I want to highlight how important it is to build your data model relationships...

## How to Embed Power BI in Sharepoint: 4 Simple Steps

Embedding Power BI reports in SharePoint Online is a powerful way to display interactive data...

## Discover Unique Insights Using Power BI TOPN Function

In this video, I wanted to find an insight that was really unique, and hugely valuable for business....

## A New Look At CALCULATE – Power BI

In this tutorial, we'll be looking at how to use the DAX function CALCULATE in Power BI. You can watch...

## Ranking Visualization In Power BI – Dynamic Visual

In this blog post, I want to teach you how to show your customers moving through groups over time in a...

## Ranking Insights Using TOPN In Power BI

In this article, we will explore how we can use the TOPN function in Power BI. You will really enjoy...

## Data Storytelling And Important Questions To Ask

When it comes to data storytelling, there are three important factors to consider to make sure that our...

Many times when you get into more advanced formula with DAX, you'll find that the totals that show up...

## Query Editor In Power BI | An Overview

In this tutorial, weâ€™ll show a detailed example of why we always need to use the Query Editor in Power...

## Utilizing Measures And Visualizations In Power BI

In this tutorial, you'll learn about the essential things that need to be prepared in making a...

## Power BI Feature Bookmark Navigator: Tutorial & Review

As part of the November 2021 Power BI updates, Microsoft included a new Power BI feature called...