Trunc percentage two decimal places

I have a report that has the option of dispalying pdf or excel. I have the pdf version working fine but i am having a little trouble on the excel version. I have a grand total and department total. Basically I need help formating two decimal places. Both dept_total and grand_total are numbers that both display. I have another column that displays what percent of the total is from each dept.It currently returns a number such as 10.23383547957459973 which i need to display as 10.23 How can i incorporate the trunc function into this code?
...to_char((dept_total/grand_total) *100)
The query looks similar to this.
select
to_char(a._grand_total)
,to_char(a.dept_total)
,to_char((dept_total/grand_total) *100)
from(
select sum(xxxx) grand_total,
sum(xxxx) dept_total
from table)a

Hi,
Since you're calling TO_CHAR anyway, you can add a 2nd argument, specifying two decimal places:
select
     a._grand_total
,     a.dept_total
,     to_char ((dept_total/grand_total) *100,       '999999999.99')     AS pct
from     (
         select  sum (xxxx) grand_total,
                  sum (xxxx) dept_total     -- Why have two copies of the same value?
         from    table
     )a If you're not using a 2nd argument, why use TO_CHAR at all in this query?
This will round the value, not truncate it. That is, if the value is 10.23<b>5</b>83547957459973, it would display '10.2<b>4</b>', not '10.2<b>3</b>'. If you always want to round toward 0 (rather than to the nearest multiple of .01), then use TRUNC.

Similar Messages

  • How do I correct % complete to show whole numbers, not two decimal places

    I just installed version P6 6.2 on my laptop and restored a schedule. The percent complete is showing two decimal places for activities less than 100%. What I would like is to have whole percentages, e.i. 84%, not 83.76%. How do I correct this? I thought it would be under the user preferences, but it's not there.
    Edited by: 795589 on Sep 20, 2010 5:46 AM
    Edited by: 795589 on Sep 20, 2010 5:47 AM

    *795589,*
    What particular percent complete are you having trouble with?
    *(Found in the P6 knowledgebase) This issue is an existing Enhancement Request. It will be considered for a future release*
    Other than that, maybe try creating a global change to manually calculate your percents.
    hope this helps,
    +*** Can the number of decimal places for Percent Complete be changed? [ID 895884.1] Modified 30-OCT-2009+

  • How to set  two decimal places in currency inr

    hi,
    i want to set two decimal places for my co.code currencu inr.  In t-code oy04 there is no 2 decimal places. Please tell me how set decimal places so that amount in account balances should be in two decimal places.
    thanks
    amol

    Hello,
    If your currency code entry isn't in OY04 customizing step, your currency code has 2 decimal place automaticly. If you want to define a special decimal place without "2", you must define it in OY04.
    Regards,
    Burak

  • 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

  • Storeing values in floate data type upto two decimal places

    Hi
    I want a float type field in my table but want to store value up to two decimal places.
    so what syntax i need to follow plz suggest.
    thanks

    it is not possible to store with Number datatype. if you are using the data to sho report, then change its format (like 45 to 45.00). if you want to store 45.00 in database, then you have to modify the datatype for that column. for this follow the following path
    1. Add a column of datatype Varchar2.
    2. Copy all the value of your number field to it.
    3. Drop the old column.
    4. However make sure that if you have used that column somewhare in arithmetic calculation, the modify it and use to_number function to do arithmetic opration.

  • Uploading Number with Two Decimal Places

    I am trying to import data from my excel file to table in the database using SQL Developer.
    It is working fine except that in my excel file I have data with two decimal places, but during import it shows only one decimal place. Is there any way I can import data with two decimal places?

    This works well with SQL Dev 1.5.X.
    Guess it would have been a bug in prior versions.

  • How can I limit a double value to two decimal place?

    How can I limit a double value to two decimal place?
    Java keeps on adding zero's to a simple double subtraction:
    1497 - 179.64 = 1317.3600000000001The answer must have been simply: 1317.36

    If the trouble is with output ...
    If the trouble is with value accuracy ...The trouble is with OPs understanding of and/or expectations of IEEE 754 floating point numbers. o_O
    [And it's probably a view (output) issue.]
    how can i actually use numberformat to cut those
    unwanted decimal places?Read the API - Puce already provided the link.

  • Convert amount with four decimal places to amount with two decimal places

    Hi,
    for specific reasons we have set the prices to four decimal places. However, in an invoice the staff needs to see all prices with two decimal places. Therefore I have created new user-defined fields which should show the rounded values However, I have not yet found the right formatted search that outputs the value with two decimal places including currency symbol.
    The statement 
    SELECT $[$38.20.NUMBER]
    outputs the value with two decimal places which is fine, but it does not contain the currency.
    The statement
    SELECT $[$38.20.0]
    outputs both value and currency, but the value still has four decimal places as the original price.
    And the statement
    SELECT CAST($[$38.20.NUMBER] AS VARCHAR(20)) + $[$38.20.CURRENCY]
    outputs a value with even six decimal places.
    Did anyone already have the same problem???
    Or does anyone have any idea???
    Thanks and regards
    Corinna

    Hi again,
    the value should be displayed in a user-defined field of the screen.
    The result of the query
    SELECT $[$38.20.NUMBER]
    has already two decimal places, so that I do not need a round here. But the currency is missing.
    When I add the round function to the query
    SELECT $[$38.20.0]
    it does unfortunatly result in an error.
    Any ideas????
    Thanks so much in advance!

  • Reduce the field value from three decimal places to two decimal places

    hi experts,
    plz help me with this
    actually i have to display the  value of the field MENGE in the list with two decimal places.
    but when i go and see the field menge in the table mseg it is having three decimal places.
    so could u plz suggest me how to solve this.
    regards
    siri

    Please try using the DEIMALS extension of the WRITE statement.
    data: menge type menge_D value '1234'.
    write:/ menge decimals 2.
    Regards,
    RIch HEilman

  • Any function module to round of a value to two decimal places?

    Hi gurus,
    Any function module to round of a value to two decimal places?

    Hi,
    you can use FM 'ROUND'.
    Thanks.

  • Price per unit is getting round off to two decimal places.

    Hi Gurus,
    In the Billing output, the Price per unit is getting round off to two decimal places.
    How can we avoid this or allow 4 decimal places for such cases.
    In the same pricing procedure, we have two pricing condition types PR02 and ZR01.
    When PR02 is being used,it doesnt rounds off Price per unit.e.g .578888 = .578888
    But when ZR01 is being used the system rounds off price per unit.e.g.578888 = .58
    Please suggest where is the setting for it.
    Thanks
    Montee

    Hi,
    Which currency you are using? If its INR, then it will do only for 2 decimal places.
    The solution for ur problem can be ractified by changing the scales :
    Also check OSS 80183
    Thanks,
    Raja

  • Is it possible to convert a float to two decimal places

    Can anyone help me to convert a float to two decimal places
    float f=16;
    System.out.println(f);
    It will print 16.0
    But I want to get printed as 16.00

    "convert" no, as no conversion is needed, obviously. Format the output, yes. Read the API for String and its printf method.

  • How to correct a double value to two decimal places

    hi,
    How to correct a double value to two decimal places
    eg.
    double tt=100.100032
    i want to correct to 2 decimal places
    ie tt=100.10
    regards,
    jagan

    Check my other reply on the other thread. Please don't cross-post.

  • How to take float precision to two decimal places?

    Hi, everybody:
    I'm a straight noob...first week in Java programming. Before you bash me for not checking FAQs and such, believe me, I have.
    I have tried BigDecimal movePointLeft, but I don't know how to construct it using proper syntax. I also tried currency and toString but I keep messing up my syntax somehow. Four hours into this and nothing is working.
    Here is the problem: I have a float. I want to format its output to two decimal places, trying to achieve in Java what C would produce as:
    printf("The amount you owe is $%.2f", fltAnyName);
    Any help would be appreciated.
    Thanks,
    Rob

    Sorry, guys. I have tried both recommendations and I can't get either to work. I'm getting a compile error pointing to the delineating period between the "out" and "printf" when I try the C-like code. I have 1.5, too. I know your advice is sound so I must be doing something wrong. Can you insert the code DecimalFormat code that will correct this problem where it needs to go? The packages below have been included becasue of all the different solutions I have attempted.
    import java.io.*;
    import java.math.*;
    import java.text.*;
    import java.lang.*;
    public class CoinCalculator2
         public static void main(String[] args) throws IOException
              String strQuartes, strDimes, strNickels, strPennies;
              int intQuartes, intDimes, intNickels, intPennies;
              float fltValue;
              BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
              System.out.println("THE COIN CALCULATOR");
              System.out.println();
              System.out.print("Enter the number of quarters you have: ");
                   strQuartes = dataIn.readLine();
                   intQuartes = Integer.parseInt(strQuartes) * 25;
              System.out.print("Enter the number of dimes you have: ");
                   strDimes = dataIn.readLine();
                   intDimes = Integer.parseInt(strDimes) * 10;
              System.out.print("Enter the number of nickles you have: ");
                   strNickels = dataIn.readLine();
                   intNickels = Integer.parseInt(strNickels) * 5;
              System.out.print("Enter the number of pennies you have: ");
                   strPennies = dataIn.readLine();
                   intPennies = Integer.parseInt(strPennies);
              fltValue = (intQuartes + intDimes + intNickels + intPennies) / 100;
              System.out.println();
              System.out.println("The value of your coins is $" + fltValue);
              System.out.println();
    }

  • How do I round calculations to two decimal places (form-wide)

    Hi,
    I've created an order form where customers input the quantity of product they want to order and the form outputs the total due (including shipping and sales tax). Depending on user input, the resulting total sometimes contains more than two decimal places. How do I round calculations to two decimal places? Is there a way to do this form-wide?
    I'm new at using Acrobat for calculations. Any help would be greatly appreciated! Thanks...

    The above will affect the displayed value not the actual value of the field nor its value when accessed in another computation. This behavior may cause an error of 1 cent or more in the grand total or sales tax computation. If you want the the value and displayed value to be the same value you can use the following Validation script:
    event.value = util.scand("%,1 0.2f", event.value);

Maybe you are looking for

  • What is the best way to create a SSRS 2005 Line Chart Report for a 12 month period?

    I'm looking for advice on how to create a SQL Server 2005 query and line chart report for SSRS 2005. I need to display the peak number of patients assigned to a medical practice each month for a 12 month period based on the end-user selecting a singl

  • G4 updated to 10.4.7, now will not boot up

    I didn't realize all of the updating issues with 10.4.7 or I would not have updated. Now my computer won't start up. This is what I did: 1. Ran Software Update for 10.4.7 2. Rebooted computer. 3. HP error message appeared about "shared Library" probl

  • IPhone 4 only syncs last photo in every picture folder selected

    My husband's IPhone 4 refuses to sync more than one photo from each folder he selects to update. It's always the last photo in the folder. He's had this problem from day one of owning the phone, and he's tried many times to fix. He's running Windows

  • Bridge JMS on SSL Mutual authenticathed Servers

    Hi all,           I'm facing a problem on bridging JMS message with WLS bridge on SSL Mutual authenticathed Servers           I configured two WLS (8.1 SP6), say "ALICE" and "BOB", with SSL listen port and I enabled "Two Way Client Cert Behavior" wit

  • Guest Users - Proxy By Pass

    Hi All, I would like to take your advice about best practice for Guest wirless users. We have Anchor controller and we are using Cisco ISE sponsor portal & Guest Portal so my query is related to proxy server. Should the guest users go through proxy o