TIMESTAMPDIFF rounding to 2 decimal places instead of 0

Hi,
Requirement is to find difference between two timestamp column,
as known one we cannot perform arithmetic operation in non number type in rpd.
Hence tried using TIMESTAMPDIFF function as below,
TimeStampDiff(SQL_TSI_MINUTE, MONITOR_TIMESTAMP, ATT_TIMESTAMP" )
OBIEE server converting this function to below SQL ,
ROUND( ( CAST(ATT_TIMESTAMP as DATE) - CAST(MONITOR_TIMESTAMP as DATE) ) * 1440 )
this returns value as ex: 12 as rounded value without any decimal places.
but we want to have two decimal places, how to fix this or any work around ?
Thanks,
Satheesh

instead of * 1440
do with
* 1440.00
btw: why you need to cast to date? why cant be timestamp?
Discard it

Similar Messages

  • Rounding to 2 decimal places in Derived column transform editor

    I want to replace the contents of a value column with itself but rounded to 2 decimal places.
    The current column is a double and I have tried to perform this using the following expression but it fails to work.
    Code Snippet
    Round(cc_vl,2)
    How should I achieve this?

    I’ll take a guess here but you started with this –
    123.45678
    Got this –
    123.45000
    Wanted this –
    123.45
    So the 123.45000 is absolutely correct, the value has been rounded to 2 digits. A double however has a scale greater than 2, and you only wanted two digits after the point because you were concerned about how the value looked rather than the actual value. This is certainly not a bug. It is how you format the data for display.
    Your solution is the way to do this, either on the Derived Column or Data Conversion Transformation. You got it in the end, the replace versus new, because you cannot change the type of a column. You may convert the value, but the storage type of the column means it will implicitly revert to the base column type when you put it back, albeit with a value that has been rounded.
    Does that explain it?

  • Rounding to 2 decimal places

    When using Math.round, I know to round to 2 decimal places it would be Math.round(variable * 100.0)/100.0. I have this in one program and it works. (answer = Math.round(answer*100.0)/100.0;) I have it in another program and it doesn't (double answer = Math.round(balances [looper]*100.0)/100.0;// balances is declared as double balances [] = new double [numberOfCustomers];) What am I doing differently that I should be looking for.

    Hi,
    Please try using java.text.DecimalFormat class. This class is a subclass of java.text.NumberFormat. You can read about this class from JDK documetation.
    HTH
    VJ

  • Rounding To Nearest Decimal Place

    Hey Flash Family,
    I am getting the correct output i want but is also giving me
    like 8 numbers after the decimal place...all i want is the numbers
    rounded to the nearest cent meaning only 2 numbers to the right of
    the decimal point....what do i need to add to the current code to
    correct this issue.
    Thanks N Advance

    attach that code to the first frame of your main timeline.
    then anytime you need to change the format of a number like
    _root.how.ROIM.val_tcost use:
    _root.return2DecPlaces(_root.how.ROIM.val_tcost);

  • Rounding to two decimal places in BPC/NW

    Hello,
    I am dealing with the task to round values to two decimal places. I have found some discussions in BPC-MS where the statement ROUND should work in logic. Unfortunately I am not able to make it work in the NW version.
    Isn't there also a parameter in the appset or application administration which would cut the numbers only to two decimal places (this task would be also a possible solution for us).
    Thanks for any help
    Jan

    Hello Pravin,
    the second import worked fine. I realized that the class has changed to ZCL_BPC_SL_ROUND.
    I debugged the class and noticed that the parameter it_cv is not filled at all. Therefore the program ends before starting the rounding procedure. Here is the part of the code:
    Take CV into account
      clear l_success.
      loop at it_cv into ls_cv.
        clear l_val_string.
        loop at ls_cv-member into l_member.
          if sy-tabix eq 1.
            l_val_string = l_member.
          else.
            concatenate l_val_string l_member into l_val_string separated by ','.
          endif.
        endloop.
        if l_val_string ne space.
          l_success = add_dim_restriction( i_param = l_val_string i_dimension = ls_cv-dimension i_clear = abap_true ).
          if l_success eq abap_false.
            concatenate 'Failed to successfully add Dimension' ls_cv-dimension into l_log_msg
            separated by space.
            cl_ujk_logger=>log( l_log_msg ).
            cl_ujk_logger=>log( 'Exiting Round Method' ).
            cl_ujk_logger=>empty_line(  ).
            raise exception type cx_uj_custom_logic
              exporting messages = et_message.
            exit.
          endif.
        endif.
      endloop.
      if l_success eq abap_false. exit. endif. - here the program exits and therefore doesn't do any rounding.
    If I comment this part the system rounds correctly but runs on all records in the cube which degrades performance a lot.
    Could you please advice further if it is possible to restrict the data region only to the submitted data?
    Best regards
    Jan

  • Rounding to 2 decimal place

    Hi,
    I am trying to round the decimal place of number 0.105 as .11.
    But it only rond up to 0.1 not 0.11.
    I don't understand why it doesn't round to 0.11.
    Can any one explain to me ?
    My code :
    import java.util.*;
    import java.text.*;
    import java.math.*;
    public class TestFile {
    public double number = .105;
    public static void main(String[] args) {
    TestFile test = new TestFile();
    DecimalFormat aFormat = new DecimalFormat("#.##");
    int decimalPlace = 2;
    double num = .105;
    BigDecimal bd = new BigDecimal(num);
    bd = bd.setScale(decimalPlace,BigDecimal.ROUND_HALF_UP);
    //DecimalFormat aFormat=new DecimalFormat("###.00");
    String formattedString = aFormat.format(test.number);//format the String entered
    System.out.println("formatted string: " + formattedString);
    System.out.println("big decimal " +bd.doubleValue());
    double formattedDouble = Double.parseDouble(formattedString);//convert to a double
    System.out.println("back to a double: " + formattedDouble);
    What should I do to round 0.11 ?
    Thanks,
    njan.

    BigDecimal bd = new BigDecimal(num);Change this line to
    BigDecimal bd = new BigDecimal(Double.toString(num));Read the notes in the API for BigDecimal constructor that accepts double.
    http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#BigDecimal(double)
    The results of this constructor can be somewhat unpredictable...

  • Rounding to a decimal place

    like, right now i have this huge equation;
    double heatIndex8 = (-42.379) + (2.04901523 * birmingTemp[7]) + (10.14333127 * birmingHum[7]) - (0.22475541 * (birmingTemp[7] * birmingHum[7])) -
                             (6.83783 * Math.pow(10, -3) * Math.pow(birmingTemp[7], 2)) - (5.481717 * Math.pow(10, -2) * Math.pow(birmingHum[7], 2)) +
                             (1.22874 * Math.pow(10, -3) * Math.pow(birmingTemp[7], 2) * birmingHum[7]) + (8.5282 * Math.pow(10, -4) * birmingTemp[7] * Math.pow(birmingHum[7], 2))
                             - (1.99 * Math.pow(10, -6) * Math.pow(birmingTemp[7], 2) * Math.pow(birmingHum[7], 2))and it prints out an insane amount of decimal places...
    how can I tell the code to round(heatIndex8) to the tens place?

    paulcw wrote:
    Use a java.text.DecimalFormat, or one of the printf methods that are now all over the place. (Well, String and java.io.PrintWriter and PrintStream, in particular).
    By the way the size of the equation doesn't have a lot to do with it.
    Edited by: paulcw on Feb 2, 2008 1:23 PMI know it doesn't, but I just really hate it.
    decimal format you say? I'll go check that.

  • Rounding to 1 decimal place.

    Hello again.
    I have a method called "findTheAverage" which takes in an array of integers as a parameter and then calculates and returns the average as a float.
    What I want to do now though is create another method called "roundTheAverage" which takes in the float average variable from the previous method, rounds it to one decimal place, and then returns it as a float called roundedAverage.
    Could anybody help me in achieving this?
    Thanks.

    I'm fairly new to Java, hi.
    Oh I know all about you.
    I'm trying to write a method which takes in a float
    called "number" and then returns this float to two
    one decimal places called "roundedNumber".
    This is not the way this works. You have to write your own code.
    >
    Could you type me the code that I'd need to do this
    perhaps?
    Nope.
    It's a pretty simple problem I think, and it's
    wasting an enormous amount of time figuring it out.
    You are right on both counts. It is very simple and you are wasting alot of everyones time.
    >
    thanksAPI Application Programming Interface
    Javadoc API
    In context for this site means the documentation for the basic packages that make up the core Java API.
    I provided a link earlier to the Javadocs for java.text.DecimalFormat
    If you can't figure it out you need to HIRE A TUTOR.

  • Round to two decimal places...and keeping trailing 0

    Ok, I have done a search on rounding. So I made this function:
        private double round(double number){
           double d = Math.pow(10, 2);
           return Math.round(number * d) / d;
        }However, if I use a number like 3.59999, it returns 3.6. For what I am using it for, I need it to return 3.60. Any ideas? Thanks.

    You normally only format for display! You seem to be wanting the default format to show 2 decimal places. This makes no sense. Internally a number(double or float) doesn't know about decimal places so how can the default format know you want 2 decimal places?
    For the most part you only need to worry about decimal places when you print a number using the DecimalFormat class.
    There are times when you might want to round values to 2 decimal places before doing more calculation. I have only met this when adding monetary values when it is important that a column total equals the sum of a displayed column values. In this case one uses something like the technique you originally proposed to round values before summing them. You then use DecimalFormat to display the values.

  • Rounding to two decimal places

    In Java, how do I round a number off to two decimal places?
    Thank You

    java.text.DecimalFormat
    Or use java.math.BigDecimal and specify rounding rules, apparently.

  • Round to 2 decimal places

    hello guys,
    I have a table. One column of the table displays the scores.
    ex: 2.2222222233333
    2.32232323
    I want to round all the numbers in that column to 2 decimal.
    Result needed: 2.22
    2.32
    Can you please help me how can i get handle to the column and round the numbers to 2 decimal places.

    Boris,
    1) You mentioned "i tried finding out the VO", I am not sure how you checked it.
    Enable diagnostics then you will get a link in the Bottom left corner called "About this page",
    click on that , and expand it, you can see the page structure there, there you can find the attached VO with your table region.
    Or
    begin
    jdr_utils.printDocument('<your page path like /oracle/apps/per/....PG>');
    end;
    Which will give the PG.xml you can load the page in Jdeveloper(with the same package)
    and you can have a look at the page structure in the page, which will give details about what VO is attached to your table region.
    2) Yes you are right, you cannot round the null value
    3) What page you are trying to get round the value, is it the FinalAppraisalPG?
    Give me the full navigation,
    Thanks.
    With Regards,
    Kali.
    OSSI.

  • Rounding to 2 decimal places WITHOUT using any formatting class

    Hello
    I'm trying to round a number (double) to 2 decimal places without using any of the formatting class like (DecimalFormat or Math.Round and BigDecimal). Is it possible to do it by just using typecast?

    OP:
    BigDecimal is not a formatting class. Math.round isn't a class at all.
    Typecasting doesn't really do that sort of thing at all (unless you count dropping fractional components when casting to an integer type).
    double holds values in binary format, so it's basically impossible to round to decimal values meaningfully.
    Chuck:
    I thought that BigDecimal supported arbitrary decimal precision, so one doesn't have to do that sort of thing....?

  • Rounding off the decimal place.

    how to round off to 2 decimal place for this following programs:
    double x;
    x = 5.0/3.0;
    System.out.println(x);
    answer for x is 1.6666666666666
    my desired output is 1.67

    import java.text.*;
    public class Foo {
        public static void main(String[] args) {
            double x;
            x = 5.0 / 3.0;
            DecimalFormat df = new DecimalFormat("0.##");
            System.out.println(df.format(x));
    }

  • Rounded to two decimal places

    Hi Friends
    i need to do rounded to two decimal value of required view attribute(messageStyleText).
    How can i get the value-> round the value ->set this rounded value in same view attribute again.
    This thing planing to do by extending the CO.
    I extended the VO but its not working...
    can anybody suggest how can we do this in controller..
    Regards
    --Harry                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi Anil,
    Thanks for your reply..
    I tried the below code..but its not seting the value
    code:
    if(pageContext.getParameter("EBtn") != null)
    OAViewObject vo =
    (OAViewObject)am.findViewObject("UpdateVO");
    String ss1 = vo.getCurrentRow().getAttribute("ECost").toString();
    pageContext.writeDiagnostics(this,"@123ECost Value is: " +ss1,1);
    double d = Double.valueOf(ss1).doubleValue();
    DecimalFormat df = new DecimalFormat("#0.00");
    String ss2 = df.format(d).toString();
    pageContext.writeDiagnostics(this,"@12345Estimated Value with 2 decimals: " +ss2,1);
    vo.getCurrentRow().setAttribute("ECost",ss2);//its not seting the value
    //I tried the below code also..but no use
    /*OAMessageStyledTextBean oastb = (OAMessageStyledTextBean)webBean.findChildRecursive("WOEstimatedCost");
    oastb.setValue(pageContext,ss2);*/
    Can any one please help me out
    Regards
    --Harry                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Round to two decimal places

    my cost per month textbox typically returns multiple decimal places, is it possible to limit it's output to two decimal places like real monetary calculations?
    calculatebutton.addEventListener(MouseEvent.CLICK, doMyCalculation);
    calculatebutton2.addEventListener(MouseEvent.CLICK, doMyCalculation2);
    costpermonth.restrict = ".0-9";
        var myAnswer : Number;
        myAnswer = Number(costofitem.text) - Number(amountsaved.text);
        amountneedtosave.text = String(myAnswer);
    function doMyCalculation2(e:MouseEvent):void
        var myAnswer2 : Number;
        myAnswer2 = Number(amountneedtosave.text) / Number(howmanymonths.text);
        costpermonth.text = String(myAnswer2);

    use the toFixed() method of numbers:
    amountneedtosave.text = myAnswer.toFixed(2);

Maybe you are looking for

  • Exclusive Free Goods

    Dear Experts, In transaction VBN1, is there anyway where I can set "Exclusive" and Calculation type "2" as default. This is to prevent the users from accidentally maintaining "Inclusive" free goods. Thanks in advance!

  • I have 2 iCloud accounts I want to amalgamate them both.  How can I do this? On one account I've bought extra storage.

    I have two iCloud accounts I want to amalgamate them both. On one account I've bought storage.  MyiPad cant be used because the message not enough storage appears. I'm pulling my hair out.

  • Ipad 2 won't go online

    I got my iPad 2 64GB Wi-fi in July, and it's worked fine until the past couple of days.  I keep getting an error that says "Safari could not display the page because it is not connected to the internet."  Or something similar.  Anyhow, my MacBook and

  • Use a C++ WinRT Component with external LIB in a C# Universal App

    Hello, I created two projects : a C++ WinRT Component project and a C# Universal app that references directly the C++ project. If I call a method from my class in the C++ Windows Runtime Component project from C# it's working fine. I got the followin

  • Rebook Hard Disc after installing SL

    Hi All, I just wanted to upgrade to SL..but something seems to have gone wrong (no idea what). Anyway, it takes now about 8 minutes to start up my MacBook Pro with an additional "teething vs teething" noise coming from the hard disc. Used Disk Utilit