March 6, 201015 yr How can fix the below calculation to round the result to a two decimal number? For example: 02:00:00 x $80.20 = $160.40, NOT $160.412457457 (I know the numbers are not accurate, just for sake of example) My current calculation: n_rate_hourly * (Hour(t_time) + (Minute(t_time)/60) Thank you for your help!
March 6, 201015 yr You really need result 160.40? Not 160.41? - a I see on example. What in this case - 160.46 also need to be 160.40? Rate calculations are very different and not always use "Round". Sometimes also function Truncate is used.
March 6, 201015 yr Most commonly changing the settings on the layout for the number display is the way to go. I presume you actually need the number rounded to the nearest penny and the dollar sign added so that you can display the info in a UI element such as a dialog or export the value already formatted. In that case you need to handle adding a trailing zero so that your answer is $160.40 instead of 160.4. Handling a dollar sign and potentially a negative sign is also needed when formatting it as text. For a numeric field called "Amount", the following may be the solution you seek. To get this behavior: 160.08256 --> $160.08 160.1 --> $160.10 -160.05665 --> -$160.06 .205 --> $0.21 Use this function: Case( Amount < 0; "-"; "" ) & Let ( [ amt = Round ( Abs(Amount) ; 2 ); dollars = Int(amt); cents = 100 * (amt - dollars) ]; "$" & dollars & SerialIncrement ( ".00" ; cents ) )
Create an account or sign in to comment