Example - How to use a drop down control to convert currencies

This post walks through how to display an input value in a different currency by using a drop down control. The user can select a currency from the dropdown and the result will appear in a label.

This example caters mainly for organisations with standard Microsoft 365 licensing. For organisations with access to Dataverse, Dataverse includes built-in functionality that takes care of currency conversions.

Creating a table of exchange rates

The key thing that's required is a table of currency exchange rates. A good place to store this data is in a SharePoint list.

To support this, we can build some external processes to keep these values up to date. There is a good blog post by Ryan Maclean on how to do this with Power Automate and custom connectors.

https://ryanmaclean365.com/2020/02/13/exchange-rate-conversion-with-power-automate/

For this example, we'll create a collection that stores the exchange rate values using the formula beneath. This collection stores the exchange rate from US dollars. We can add this formula to the OnStart or OnVisible properties of the app or screen respectively.

ClearCollect(
colExchangeRates,
{
Currency:"Euro",
Rate:1.01423
},
{
Currency:"British Pound",
Rate:0.88539
},
{
Currency:"Indian Rupee",
Rate:80.908139
},
{
Currency:"Australian Dollar",
Rate:1.505248
},
{
Currency:"Canadian Dollar",
Rate:1.345757
},
{
Currency:"Singapore Dollar",
Rate:1.416514
},
{
Currency:"Swiss Franc",
Rate:0.978288
},
{
Currency:"Malaysian Ringgit",
Rate:4.566888
},
{
Currency:"Japanese Yen",
Rate:141.501547
},
{
Currency:"Chinese Yuan Renminbi",
Rate:7.061676
}
)

Adding the currency drop down control to a form

From our app, we can then add a drop-down control (ddCurrency) and set the Items property to colExchangeRates.


Note that in this example, the form is a display form and therefore, we must set the display mode of the data card to make the drop-down control selectable for the user. The dropdown control will be disabled if we fail to do this.

Next, we can add a label and multiply the target value by the selected rate in the drop-down control like so:

ThisItem.AquisitionPrice * ddCurrency.Selected.Rate

We can also incorporate a call to the Text function to format the result more cleanly.


At runtime, the user can now use the dropdown to display the value in one of the available currencies.

Related posts

FormuIas - Is it possible to call a user-defined function recursively in Power Apps?
January 31, 2024
Formulas - A beginners guide on how to create and call user-defined functions (UDFs)
January 28, 2024
Formula - How to add a button that converts degrees Centigrade to Fahrenheit and vice versa
May 08, 2023
Formula - How to convert a single delimited string to rows and columns
April 05, 2023
Data - How to group data in a gallery and calculate sums
January 20, 2023
Formula - How to calculate compound interest
November 24, 2022
Utilities - The best way to peform OCR on images of Power Apps Formulas
October 11, 2022
Formula - How to parse JSON in Power Apps- 4 examples
September 15, 2022
Data - How to get a row by ordinal number
April 28, 2022
Formula - What to do when the If statement doesn't work?
December 17, 2021
Formula - Boolean And / Or operators - What is the order of precedence?
December 16, 2021
Controls - How to set the data source of a Combo Box to a comma separated string
November 16, 2021
Numbers - 10 examples of how to round numbers
August 18, 2021
Formula - Difference between round, square, and curly brackets
July 20, 2021
Top 3 highlights of upcoming enhancements to the Power Apps language (Power FX)
May 26, 2021
Email - Sending email attachments with the Office 365 Outlook connector
March 30, 2021
Formula - What to try when numbers don't format correctly
March 24, 2021
Controls - How to convert HTML to Text
March 23, 2021
Formulas - how to return all days between two dates
March 15, 2021
Formula - How to create comma separated (CSV) list of items
February 25, 2021
Formula - How to use the IF and Switch functions - 3 common examples
February 12, 2021
Location - Finding the closest location and and sorting records by distance, based on the current location of the user
January 24, 2021
Formulas - How to cope with weekends and public holidays in date calculations
January 21, 2021