Hello! @nasreen-akter
Anyone know how to Round to 2 decimal places in an ADF Pipeline?
Thanks!
Mike
Hi @ewinkiser ,
Following up to see if below answer helps? If yes, Please mark it as accepted answer. Accepted answers helps community as well. Thank you.
Hi @ewinkiser ,
Just checking if below answer helps? If yes, Please mark it as accepted answer. Accepted answers helps community as well. Thank you.
Hey,
you can use dataflow:

https://docs.microsoft.com/en-us/azure/data-factory/data-flow-expression-functions
Thanks my friend, @NandanHegde-7720
How would you do it without using Data Flows and just in an ADF pipeline?
Thanks
MIke
Hey @ewinkiser ,
Sorry to have missed out on this thread!
Yes, as @ShaikMaheer-MSFT mentioned, it is not directly possible in ADF as of today without use of dataflow but we can have a workaround via using mathematical and conditional expressions . thats how we usually do it :
in case if we want to round upto 2 decimal we check whether the 3rd digit value is greater or equal to 5 and then add 0.001 else follow the below logic as is.
Hi @ewinkiser ,
Following up to see if below answer helps? If yes, Please mark it as accepted answer. Accepted answers helps community as well. Thank you.
Hi @ewinkiser ,
Thank you for posting query in Microsoft Q&A Platform.
In ADF Pipeline round() function is not available. Hence we need to go with below explained work around to achieve same.
Implementation:
If you want to round 123.43467 to two decimal places, you need to multiple 123.43467 with 100(123.43467 *100 = 12343.67), then take only left side part(12343) from 12343.67. And then divide the result (12343) by 100 to get 123.43
Please check below image which has similar logic in expression and got result.
expression used: @string(div(float(split(string(mul(123.43467,100)),'.')[0]),100))

If you would like to do round in mapping data flows then round() function is available there.
Hope this will help. Please let us know if any further queries.
Please don't forget to click on
or upvote
button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
Want a reminder to come back and check responses? Here is how to subscribe to a notification
If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
Hey @ShaikMaheer-MSFT ,
My guess is there is a slight correct in the above expression.
We also follow the above logic but we check the next digit >=5 and add 1 to the preceding value accordingly.
Because based on above logic, if the input is 123.43667 the output should have been 123.44 but it would still be 123.43.
Hi @@ewinkiser ,
As @NandanHegde-7720 mentioned you can consider checking next digit >=5 and then add 1 to preceding accordingly.
Kindly mark it as accepted answer if this works for you. Please let us know if any further queries. Thank you.
7 people are following this question.