Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
ross27
Advocate II
Advocate II

Rounding x.5 to 0 decimal places and converting to text

When I round a number to zero decimal places and then convert to text I get a suprious ".0" added to any values that end in .5

 

For example:

 

let
   Input = 12.5,
   Output = Text.From(Number.Round(Input))
in
   Output

 

Returns "12.0" rather than "12"

 

I can fix my output easily enough, but could someone please explain why this happens? 

2 REPLIES 2
artemus
Microsoft Employee
Microsoft Employee

Number.Round has a second parameter which takes the number of decimal places. As a result this returns a number which in its base form is floating point. You can use Int64.From(x) to convert a floating point number to an integer based number

Thanks @artemus .  That's what I've ended up doing, but I don't really see why I have to.  Even when I specify 0 as the second parameter I end up with a number that is shown to 1dp.   Wouldn't you expect Number.Round to take care of this itself?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.