web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Regional setting messi...
Power Apps
Answered

Regional setting messing with formulas

(0) ShareShare
ReportReport
Posted on by 832
So I have this code for a Text Label inside a Gallery that's grabing its items from a Collection: 
If(IsBlank(ThisItem.Base);"";If(Len(Text(ThisItem.Base;"0.00000"))-Find(".";Text(ThisItem.Base;"0.00000"))=1;// Un decimal
Text(ThisItem.Base*10;"0.00")&"%";// Multiplica por 10
If(Len(Text(ThisItem.Base;"0.00000"))-Find(".";Text(ThisItem.Base;"0.00000"))=2;// Dos decimales
Text(ThisItem.Base*1;"0.00")&"%";// Multiplica por 1
If(Len(Text(ThisItem.Base;"0.00000"))-Find(".";Text(ThisItem.Base;"0.00000"))=3;// Tres decimales
Text(ThisItem.Base/10;"0.00")&"%";// Divide por 10
If(Len(Text(ThisItem.Base;"0.00000"))-Find(".";Text(ThisItem.Base;"0.00000"))=4;// Cuatro decimales
Text(ThisItem.Base/100;"0.00")&"%";// Divide por 100
Round(ThisItem.Base/1000;2)&"%"// Cinco decimales o más, redondea y divide por 1000
)))))
The end result would be something like 45,00% or 55,55%. I do all that complicated part because the original data (ThisItem.Base) is "0.575", and I can't use "." as decimal separator and I need it to be easier to read. 
 
This code has worked in my Spain enviroment for the past year but now someone from Portugal needs to use the app and he's been getting this error non stop
 (It's not possible to cover the value "0.55" to number)
So something weird is happening in his regional settings. So how can I fix it to keep everyone happy so that the final result is still the same output format? And why the hell this is happening in the first place?

Is there a way that I can switch my settings to Portuguese settings so I can do the testing on my own? So far I've been editing two little things and asking the person to try the app... Very slow process.
 
Appreciate any feedback in advance!
 
I have the same question (0)
  • Verified answer
    PowerDeveloperTP Profile Picture
    244 on at
    Hello,
     
    Power apps uses your local browser and machine locale. If you want to test what is happening with Portuguese settings, please update your machine regional settings under display settings, also browser settings to same region. Thank you.
     
     
    Like my answer? - Hit that Thumbs Up. Resolved the Issue? - Hit Accept as Solution.
    This helps others find solutions to future issues!
  • Verified answer
    WarrenBelz Profile Picture
    153,462 Most Valuable Professional on at
    The fundamental issue is here
    Text(
       ThisItem.Base;
       "0.00"
    )
    as European syntax is expecting
    Text(
       ThisItem.Base;
       "0,00"
    )
    The decimal seperators normally take care of themselves based on the user device Regional/Language settings, but you have hard-coded this.
     
    I cannot test the code below as I do not have different regions, but it should work - you may also have to play around with the _Factor numbers to suit what you are doing as I do not completely understand why you are dividing four decimal places by 100 and three by 10.
    I have added a second region to show how you add more and there is also no rounding required if you format to two decimal places (the formatting does this for you)
    With(
       {
          _Region: If(
             Office365Users.UserProfileV2(User().EntraObjectId).preferredLanguage in ["pt-PT"; "pt-BR"];
             "0,00";
             "0.00"
          );
          _Factor: Switch(
             Len(
                Last(
                   Split(
                      ThisItem.Base;
                      "."
                   )
                ).Value
             );
             1; 10;
             2; 1;
             3; 0.01;
             4; 100
          )
       };
       Coalesce(
          Text(
             ThisItem.Base * _Factor;
             _Region
          ) & "%";
          ""
       )
    )
    
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Power Platform 1919 Profile Picture
    2,056 on at
    Hi ,

    Not sure if this will help, but you can try using the Language() function. It can help a lot with these kinds of formatting issues when users have different regional settings.

    For example, instead of hard-coding a locale, you can format the value using the current user’s language:  (My language is "en-US")

    Text(0.55 * 100, "0.00%", Language())



    This way, the decimal separator and formatting adapt automatically to the user’s locale, whether they’re in Spain, Portugal, or somewhere else.

    You can also use Language() with the Value function when converting text to numbers, for example:
    Value("0.55", Language())
    This helps ensure the number is interpreted correctly based on the user’s regional settings.
  • WarrenBelz Profile Picture
    153,462 Most Valuable Professional on at
    I updated my post - must have been getting late - you can detect the user's language. You might also look at the condensed code - much easier to define everything you repeat at the start.
  • WorkingRicardo Profile Picture
    832 on at

    Hey guys! Thanks for all your posts, I used a littlbe bit of what you guys said to fix my formula and now is running.

    Considering what was frustrating me the most was how to test in myself and you recommended fixing the browser and settings, Ill pick that answer as the solution. 

    Thanks again :)
  • WarrenBelz Profile Picture
    153,462 Most Valuable Professional on at
    I assume that my post with the condensed code would have assisted - I spent quite some time building a model to test this. Also my interpretation of your post was that you wanted the app to work in both regions and both mine and @Power Platform 1919's posts addressed this in different ways.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 421

#2
WarrenBelz Profile Picture

WarrenBelz 386 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 339 Super User 2025 Season 2

Last 30 days Overall leaderboard