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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Kentz
Regular Visitor

Rounding problem in both Power Query Editor and Dataflow on web

When using rounding to 2 decimals, the result is,

0.005 = 0

0.015 = 0.02

0.025 = 0.02

0.035 = 0.04

0.045 = 0.04

0.055 = 0.06

0.065 = 0.06

0.075 = 0.08

0.085 = 0.08

 

is this a bug?

rounding.png

1 ACCEPTED SOLUTION
KNP
Super User
Super User

Hi @Kentz

 

There was a blog post somewhere explaining this, I can't find it right now but will link it if I do.

I think adding the optional rounding mode will give you what you're looking for.

 

See last step below...

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jMwMFWK1QExDGEMIxjDGMYwgTFMYQwDExjDUCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type number}}),
    #"Inserted Rounding" = Table.AddColumn(#"Changed Type", "Round", each Number.Round([Column1], 2, RoundingMode.Up), type number)
in
    #"Inserted Rounding"

 

Hope this helps.

 

Kim

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

View solution in original post

4 REPLIES 4
KNP
Super User
Super User

Hi @Kentz

 

There was a blog post somewhere explaining this, I can't find it right now but will link it if I do.

I think adding the optional rounding mode will give you what you're looking for.

 

See last step below...

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W0jMwMFWK1QExDGEMIxjDGMYwgTFMYQwDExjDUCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type number}}),
    #"Inserted Rounding" = Table.AddColumn(#"Changed Type", "Round", each Number.Round([Column1], 2, RoundingMode.Up), type number)
in
    #"Inserted Rounding"

 

Hope this helps.

 

Kim

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
Kentz
Regular Visitor

CHAMP!! That worked. Thanks so much!

v-yetao1-msft
Community Support
Community Support

Hi @Kentz 

Is the column you set up as a regular numeric column or is it generated by dax ? And whats your datasource ?

I enter data in desktop directly and set to two decimal places , you can see the result ,0.085=0.9 . It is normal in my sample .

Ailsa-msft_0-1621243965407.png
Ailsa-msft_1-1621243965411.png

My current desktop version is in May, maybe you can upgrade to the latest version to test the results .

https://www.microsoft.com/en-us/download/details.aspx?id=58494

 

Best Regards

Community Support Team _ Ailsa Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yetao1-msft , thanks for your reply! Yes that rounding works. But the problem occures when using rounding in Power Query Editor and Dataflow. And confirming I'm using the latest client.

 

rounding.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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