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 / Mathematical Order of ...
Power Apps
Unanswered

Mathematical Order of Operations - Bug with Format Text in Code

(1) ShareShare
ReportReport
Posted on by 1,346

Hello Microsoft.

 

I am sure there used to be a forum for bugs on the community, but I can't seem to find it now.

 

I found that one of my formulas would randomly stop working and I then found that the "Format Text" option in the formula editor is destroying mathematical order of operations by removing brackets.

 

If we start with this formula it returns the correct value because we need the subtract to execute first.

PowerApps Order of OperationsPowerApps Order of Operations

If you then choose to format text, it removes the brackets

Format Text.jpg

 

This then obviously breaks the intended result because of order of operations.

 

Incorrect Value.jpg

 

I am pretty sure this is a bug 😉

Categories:
I have the same question (0)
  • bscramling Profile Picture
    on at

    Dawidvh,

     

    You're not alone. I input this code...

     

    RoundDown
    (
     (
     (
     DateDiff(
     CheckInTime,
     LunchOutTime,
     Minutes
     )
     + 
     DateDiff(
     LunchInTime,
     CheckOutTime,
     Minutes
     )
     ) / 60
     ),
     1
    )

    ...and it gives me the correct number. However, when I click "Format Text" I get the following...

     

    RoundDown (
     DateDiff(
     CheckInTime,
     LunchOutTime,
     Minutes
     ) + DateDiff(
     LunchInTime,
     CheckOutTime,
     Minutes
     ) / 60,
     1
    )

    ...which is giving me the wrong number. Quite annoying.

     

    I also discovered that if you use /* --- */ at the end of your code to comment out some code, when you click "Format Text" it will sometimes, but not always, remove all the commented code.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 414

#2
Valantis Profile Picture

Valantis 387

#3
timl Profile Picture

timl 344 Super User 2026 Season 1

Last 30 days Overall leaderboard