Skip to main content
Question

How to RoundUp or RoundDown Decimal


Dear TimeXtender's Team,

What is choice to setting rounding in TimeXtender if we want to set up decimal ? 

Like example .. 
in Original Data is $12,3456, we just want the result is $12,34 (2 decimal)

because in TX, it will be $12,35

Thank you,

Forum|alt.badge.img

To round down (truncate) you can use the third argument of the ROUND function.

https://docs.microsoft.com/en-us/sql/t-sql/functions/round-transact-sql?view=sql-server-2017#c-using-round-to-truncate


  • Community Manager
  • August 16, 2019

Hi Ghazy, Thanks for posting this question. This is a very common problem with a straightforward solution. I would solve this by doing the following in Discovery Hub.

I have a sales transaction table with a field called Sales Amount. 

In my example, I created two additional fields. The first is named SalesAmount(NoDecimal) where I have edited the field and reduced the fractional digits to zero. 

VMlsuROJ7nHavZk3WFnl7Q.png

I added a custom transformation to this field. 

o3rPWPfY8SluG7oNLM7mLw.png

Next, I added another field with the same, zero fractional digits, called SalesAmount(Floor). 

This time I added a transformation but used the FLOOR function. As you can see in the snip below I am using FLOOR() with the field I want to round down in the parenthesis. See here for more info on using FLOOR.

sdf91Xy34iIoN_LpWSPHOw.png

So my fields in Discovery hub appear like this

w4BRlPbqf4bE9elubxbIKQ.png

 

And Finally, the data appears like this: 

gWYY6ow2z2KUbLdMuV3LDQ.png

 

Hope that helps!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept or continue browsing you agree to our cookie policy. Learn more about our cookies.

 
Cookie settings