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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Whole number conversion issue in Power Query

Hi,

 

Please find the below, while converting  the Decimal to whole number - sometimes round up is working and sometimes round down .

Example- For  62.5 and 61.5 showing same value.

If 0.5 come then it needs to Round up like highlighted in red color.

 

 

mogunase1_0-1677572050184.png

Result , i need like below in Query editor itself.

mogunase1_1-1677572485733.png

 

Thanks,

@amitchandak@Greg_Deckler

 

1 REPLY 1
ronrsnfld
Super User
Super User

How are you converting it?

 

It seems that if you just set the data type to "Int64.Type" the system will round to the nearest even number (so-called banker's rounding although I don't think it was used by bankers).

 

That rounding method actually decreases the variance compared with always round 0.5 up.

 

If you want to change the rounding method from the default, you can accomplish the conversion using `Int64.From` and specify your desired rounding method.

For example:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtAzVYrViVYyhNImUNrMCMaAyZgZ65koxcYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Test = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Test", type number}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Result", each Int64.From([Test],"en-US",RoundingMode.AwayFromZero), Int64.Type)
in
    #"Added Custom"

 

 

ronrsnfld_0-1719258581330.png

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors