Solved

How to RoundUp or RoundDown Decimal

  • 16 August 2019
  • 2 replies
  • 22 views

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,

icon

Best answer by JTreadwell 16 August 2019, 22:31

View original

2 replies

Badge

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

Userlevel 3
Badge +5

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 TimeXtender.

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. 

I added a custom transformation to this field. 

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.

So my fields appear like this

And Finally, the data appears like this: 

 

Hope that helps!

Reply