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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Allow only .5 in decimal
Power Apps
Answered

Allow only .5 in decimal

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, 

 

I'm creating an application that only allows .5 for the decimal. Just wondering if the Round function will allow it. 

 

So for e.g. user can only input whole number or 1.5, 0.5, 2, 2.5, 3, 3.5, 4.5

 

Thank you. 

 

Best Regards,

Jacq

Categories:
I have the same question (0)
  • Mitanshu Profile Picture
    1,656 Moderator on at

     

    If you use following, then you will get output in decimal to nearest 0.5

    1.75 to 2.24 will give 2.0

    2.25 to 2.74 will give 2.5

     

    happyume_0-1626950209908.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Is there a way that round it up while the value in the input text change? Thank you.

  • Mitanshu Profile Picture
    1,656 Moderator on at

    On the OnChange property of the Input control, create a variable that will hold your rounded value, and then in the Default property of the Input control use that variable.

    happyume_0-1627025518520.png

     

    Once your user types the value and come out of the TextInput control, the OnChange will kick-in and set the value to be in rounded format as you want.

     

    If you want to always RoundUp, then instead of using Round (in my screenshot) use RoundUp instead.

     

    --

    If this post helps, then please Accept it as the solution to help the other members find it more quickly.

     

    If my responses help you in getting your desired solution or clearing your concepts or helping you troubleshoot then please give Thumbs-up.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

    Based on the issue that you mentioned, do you want to make the input either an integer or a decimal of 0.5?

    I have a simple test for you, please take a try.

    Set the OnChange property of the text input control as below:

    If(
     !IsMatch(
     TextInput1.Text,
     "^([1-9]\d*|0)(\.5)?"
     ),
     Notify(
     "Either an integer or a decimal of 0.5 is allowed!",
     NotificationType.Error
     ),
     Notify(
     "Input correctly!",
     NotificationType.Success
     )
    )

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Need to enforce nearest to .5 for textbox

     

    delajz_0-1627882806326.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This helped a lot!!! Thank you so much

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard