March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
In the documentation for custom numeric format strings:
However, in actual testing, it was found that the following expression would produce an unexpected result:
// 0%
Number.ToText(0.4, "0;-0;0%")
// 0.4
Number.ToText(0.4, "0.0;-0;0%")
So, is this a bug?
Solved! Go to Solution.
Sorry, missed that and learned something.
What do you expect for output given those format strings.
The second one appears correct. What would you expect for your first format string?
The behavior you see is documented in the link you provided:
If the number to be formatted is nonzero, but becomes zero after rounding according to the format in the first or second section, the resulting zero is formatted according to the third section.
Your results look correct to me as well. in the first case you were saying if it's positive, make it a whole number, which rounds down to zero, and since your third argument says if zero make a percent, you, get 0%. in your second example you say if the number is positive make it one decimal therefore you get 0.4 which does not equal zero and therefore does not become a percent.
--Nate
deleted as incorrect
Sorry, missed that and learned something.
What do you expect for output given those format strings.
The second one appears correct. What would you expect for your first format string?
The behavior you see is documented in the link you provided:
If the number to be formatted is nonzero, but becomes zero after rounding according to the format in the first or second section, the resulting zero is formatted according to the third section.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.