Format numbers locally to your user in Power Apps

format numbers

Format numbers locally to your user in Power Apps

By:

Date:

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

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There’s a better way — and I can show you exactly what it looks like. I’m the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I’ve been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. SharePains is not just any blog run by a Microsoft MVP. Have you ever used Try-Catch in Power Automate? The original post about Try-Catch in Power Automate can still be found on this site, https://staging.sharepains.com/2018/02/07/try-catch-finally-in-power-automate-flow/ Or have you ever used the Pieter’s method to avoid variables and speed up your flows? https://staging.sharepains.com/2020/03/11/pieters-method-for-advanced-in-flows/ You can contact me using contact@staging.sharepains.com

Tags:

4 responses to “Format numbers locally to your user in Power Apps”

  1. Daniel Avatar
    Daniel

    Thank you for sharing this. Will this work on the date picker with the language letting on that?

    1. Pieter Veenstra Avatar

      The date picker should already pickup the local settings for the user.

  2. lcaiola Avatar

    5 stars. But what I need it’s a way to add the value 1 to the number before in a key filed.

    1. Pieter Veenstra Avatar

      Do you mean something like : Set(varValue, varValue + 1)

Leave a Reply

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