Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I need to use the Round() function in order to round the data whit this logic:
If the data has any decimal values it is rounded to .5 or next integer, if the data has no decimal values it remains as it is (integer).
is this possible: ie.
1.2 --> 1.5
1.6 --> 2
4 --> 4
hope you can help me.
Might be easier to use Frac function here
If(Frac(Number) > 0, Ceil(Number, 0.5), Number)
or just this
Ceil(Number, 0.5) as Number
Hi,
Decimal part
=If(IsNull(SubField(RoundingNumbers, '.', 2)), 0, SubField(RoundingNumbers, '.', 2))
Rounded Number
=If(IsNull(SubField(RoundingNumbers, '.', 2)), RoundingNumbers,
If(SubField(RoundingNumbers, '.', 2) <=5, Num#(SubField(RoundingNumbers, '.', 1) & '.' & '5'), Num#(SubField(RoundingNumbers, '.', 1) +1)))
BR,
Vijay
Might be easier to use Frac function here
If(Frac(Number) > 0, Ceil(Number, 0.5), Number)
or just this
Ceil(Number, 0.5) as Number
Check this out
Table:
LOAD Number,
If(Frac(Number) > 0, Ceil(Number, 0.5), Number) as Test1,
Ceil(Number, 0.5) as Test2;
LOAD * INLINE [
Number
1.2
1.6
4
];
Thank you so much for your answer but I see that the @Sunny Talwar is a little more practice way and it solve my need.
Best regards!
Thank you very much I see the Ceil() function is what I was looking for.
Best Regards!