format numbers

Format numbers locally to your user in Power Apps

A while back I wrote about formatting numbers in Power Automate. Today a quick post about how to format numbers in Power Apps.

Format numbers

Before you start to format all number in your app localized to the language settings of the logged in user. You might not want to do that!

Imagine a payslip app and the currency on my payslip automatically adjusted to where I was located. That could be fun!

But sometimes there are good reasons to format numbers.

Just to give a few examples:

In the UK we format the number 2,123,456.00 where in the Netherlands this same number would be shown as 2.123.456,00.

To format numbers we can use the Text function in Power Apps.

The Text function

The Text function uses the following syntax:

Text(Value, format, local)

So we could fro example format our number like this:

Text (2123456, "##.00", "en-GB")

or


Text (2123456, "##.00", "nl-NL")

Or if you want currencies to be included:

Text (2123456, "$##.00", "nl-NL")

This is all great, but we don’t really want to set the local to nl-NL or en-GB. We want to use the local formatting depending on the language settings of the user that is logged in.

The Language function

We have a function available to us that will help us. The language function will pick up the language settings for the user. So in my case my languages settings are en-GB and numbers will be shown correctly when I use the following expression:

format numbers with Text and language function

2 thoughts on “Format numbers locally to your user in Power Apps

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 4,912 other subscribers

Recent Posts

Archive

Thank you for visiting SharePains