Latest Posts

PowerApps remove fractional part of a number


The Trunc function in PowerApps is used to truncate a number to an integer by removing the fractional part of the number. This function is useful when you need to ensure that a number is rounded towards zero, effectively stripping off any decimal places.

PowerApps – Trunc() function Syntax

 

Trunc(Number)

  • Number: The number you want to truncate.

Notes:

  • Whole Numbers: If the input number is already an integer, Trunc returns the same number.
  • Zero: If the input number is zero, Trunc returns zero.

PowerApps - Basic Example to truncate number

To truncate the number 3.75 to an integer:

Trunc(3.75)

This returns 3.

PowerApps - Basic Example to remove decimal part of Negative number

To truncate the negative number -3.75 to an integer:

Trunc(-3.75)

This returns -3.

PowerApps – truncate Variable value

Suppose you have a variable MyNumber containing the value 7.89, and you want to truncate it:

Trunc(MyNumber)

 

PowerApps – Remove Decimal Part of a Calculation

If you have a calculation result and you want to truncate it to an integer:

Trunc(Sum(Orders, Amount) / 10)

This truncates the result of the division to an integer.


We value your Feedback:

Page URL:

Name:

Email:


Suggestion:

© 2024 Code SharePoint