Trunc 2 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

Use ROUND:
select to_char(round(10.23383547957459973, 2)) from dual;
10.23

Similar Messages

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

  • Decimal places in charts

    Hi
    I have this SQL code for a pie chart and it rounds items down to 0% instead of showing decimal places. Is is possible to change it to show 0.5% for example?
    select null link, PRODUCT label, 100*ratio_to_report(COUNT(ID)) over () value
    from CHART_BY_PRODUCT
    WHERE REGION = NVL(REPLACE(:P17_REGION, '%null'||'%', NULL), REGION)
    AND LOB = NVL(REPLACE(:P17_LOB, '%null'||'%', NULL), LOB)
    AND TRUNC(TO_DATE(DATECALLED)) BETWEEN TRUNC(TO_DATE(:P17_FROM_DATE))
    AND TRUNC(TO_DATE(:P17_TO_DATE))
    group by PRODUCT
    order by count(id) descRegards
    Adam

    Basically this function - 100*ratio_to_report(COUNT(ID)) over () - is showing values in percentage. i.e. 40%, 20%, 5%, 1%, 0%.
    I want it to show the percentage with decimal places i.e 40.52%, 20.3%, 5.2%, 1.25%, 0.25%
    Can I change the function somehow to show two decimal places?
    Thanks
    Adam

  • Need to trim decimal Places in data pulled in Financial report

    Hi All,
    We have a Financial report in which in partcular column, data is being pulled by the formula :
    <<CellText("Grid1", Cur, C(A), 1)>>
    Some cells in that column contains only text comments, some cells having numbers only.
    Issue is with the numbers. Numbers when pulled in FR are being dispalyed upto 6 decimal places, i.e. 1234 is displayed as 1234.000000.
    So if somebody can suggest how can we modify the formula so that we can display the numbers without decimal values. i means , numbers being pulled are displayed as 1234 only not like 1234.000000.
    Thanks,
    Satish

    Hi there,
    You can use the function Trunc(xxxxxxx, 0) where xxxx is your retrieved value which is considered as numeric.
    However, if I were you, I would concentrate on how to resolve the issue with the smartview submission.
    Regards,
    Thanos
    One Truth about...

  • Displaying all numbers with 2 decimal places

    Hi All,
    We have a requirement in our code where we want that all numbers must be diplayed with 2 decimal places.
    Eg: If a number is 21.234 then it should be displayed as 21.23
    If a number is 21.289 then it should be displayed as 21.28
    If a number is 21 then it should be displayed as 21.00
    Can anyone please help me how to do it in a SQL query.
    Regards,
    Shruti

    Hi, Shruti,
    This shows a couple of things you can do:
    COLUMN     trnc     FORMAT     999999.99
    WITH     got_x     AS
         SELECT     empno / 1000     AS x
         FROM     scott.emp
    SELECT     x
    ,     TO_CHAR (x,            '999999.99')     AS tc
    ,     TO_CHAR (TRUNC (x, 2), '999999.99')     AS trnc_tc
    ,     TRUNC (x, 2)                              AS trnc
    FROM     got_x
    ;Output:
    `        X TC         TRNC_TC          TRNC
         7.369       7.37       7.36       7.36
         7.499       7.50       7.49       7.49
         7.521       7.52       7.52       7.52
         7.566       7.57       7.56       7.56
         7.654       7.65       7.65       7.65
         7.698       7.70       7.69       7.69
         7.782       7.78       7.78       7.78
         7.788       7.79       7.78       7.78
         7.839       7.84       7.83       7.83
         7.844       7.84       7.84       7.84
         7.876       7.88       7.87       7.87
           7.9       7.90       7.90       7.90
         7.902       7.90       7.90       7.90
         7.934       7.93       7.93       7.93Column x is the number, as SQL*Plus displays it by default. Note there are as many digits after the decimal point as are needed.
    Column tc shows how TO_CHAR can format the number, with exactly 2 digits after the decimal point. This automatically rounds the number to the nearest multiple of .01, so on the first row (for example) 7.369 gets displayed as 7.37.
    user11272043 wrote:
    ... If a number is 21.289 then it should be displayed as 21.28You (apparantly) always want the number rounded toward 0, so column tc isn't quite what you want.
    Column trnc_tc is exacly what you requested, with the numbr rounded toward 0 (when any rouning is necessry) and 2 digits after the decimal point.
    Column tc is also exactly what you requested, but it uses SQL*Plus formatting rather than SQL. Also, column trnc is a NUMBER, while column trnc_tc is a VARCHAR2, because TO_CHAR, as its name hints, returns a VARCHAR2.
    The SQL*Plus command
    SET   NUMFORMAT  999999.99changes the default format for all number columns. If you use this, you can override it for individual columns by using TO_CHAR (since it returns a VARCHAR2, the NUMFORMAT doesn't apply),or a COLUMN command. Also, if you use SET NUMFORMAT 999999.99, you'll still have to explicitly TRUNC every number, or else 21.289 will come out as 21.29, not 21.28.

  • Error while updating decimal places in general settings

    Hii All
             I have got an error while updating Decimal places in General Settings
    Cannot update while another user is connected to the company i have checked, there is no other user logged in, i could add other settings but the problem is only with Decimal Places
    Note : there are no postings yet, a fresh database for a new client
             what could be the possible reason
                                                                 thanks
                                                                         RIYAZ

    Hiii All
          As a forum rule, i have initially gone through with the existing threads and then i was force to post a thread,
              would be helpfull if there is any other way..
                                                Thanks
                                                         RIYAZ

  • Decimal places in report painter

    Hi experts.  I have a financial report written in report painter.  I want to show two decimal places on a single row.  The rest of the report is in whole dollars, but this one row is a percentage, so I want to show decimal places.  I know that you can format an entire column, but I can't figure out how to format a single row.  Can anyone help?
    Thanks
    Janet

    YES U CAN
    SAME AS ABOVE PROCEDURE
    BUT SELECT ROW INSTEAD OF COLUMN
    Edited by: Anil Kumar Potnuru on Feb 10, 2009 9:02 PM

  • Can not change the number of decimal places in the normalization of result

    dear all
        i want to see the proportion of some data, for example, the income of May is 300, and the total income is 1000, i need to display it like 33.33% . so i set the
    Calculate single values as normalization of result, and then it display 33.333%, i like to display only two number of decimal places, so i set the number of decimal places as 0.00, but i doesn't work, it still display three decimal numbers.
        maybe you say i can use the percentage function like %CT %GT %RT, but i need to allow external access to my query, so the i can not use those functions.
        can somebody helps me ? your advice is appreciated.

    hi,thanks for your advice, but that doesn't suit for my problem.
    before i set the normalization of result, i can change the decimal values. After that i cann't.
    In your thread, someone proposes use the T-code OY04. but this wouldn't help. As i change to other key figure, such as user quantity, when i set normalization of result, it still display 3 decimal values.
    i think the point maybe lie in the normalization of result. please advise... thanks...

  • Problems with decimal places and formatting

    Hi , we are having problems with an add on running on different localization companies. Decimal places separatd by "," differ from other localizations. We dont know if this is a SQL collation setting or somethng related to code or requirements to run add ons on different servers and languages.
    Any ideas??
    Thanks

    Hello
    Follow up with this thread:
    [Re: How to get the numeric value of DocTotal from UI API]
    Regards,
    J.

  • Decimal Places in Item Cost must be 6 characters while in Journal Entry 2.

    I have the following problem:
    Accounting needs to see and work with 2 decimal places, but the item cost is needed in 6 decimals.
    If I register a A/P Invoice and i go to the Journal Remark, the Journal Entry should be in 2 decimals. If i look for the Item Cost on the Wharehouse this cost should be in 6 decimals.
    Is there a way to handle Accounting in 2 units and Cost in 6 Units
    Thank You very much

    Hi Saul,
    The request appears illogical, how can the accountant work with 2 decimal places & the item valuation is held with 6? The stock account with 2 decimals will never match the stock audit report with 6 decimals.
    I'm afraid the SAP Business One core functionality does not cater for this need. There are no 'behind the scenes' journal entries. A JE is legally binding so you need to decide whether you wish to work with the most accurate calculations regarding item cost as possible (6 decimals) or accommodate the accountants & work with 2 decimals in the journals.
    You might want to take the nature of the stock into consideration, if there are huge quantities at small individual prices 6 decimals might be better, if you use mainly standard cost &/or have no major cost fluctuations when using MAP/FIFO, 2 decimals might be sufficient.
    All the best,
    Kerstin

  • Decimal places in standard input schedule templates

    Hi Gurus
    I have created some input schedules using standard template. User here will be entering some values in 2 decimal places (like 1.25) but when I enter any values in the cells, it automatically round off the values and displays values without any decimal places.
    I have tried changing the formats in Format control panel by changing the DATA / DEFAULT 's PATTERN / ALL for ROWs but it did not help.
    Please help how to resolve this.
    Cheers
    Swathi

    Hi nilanjan,
    Thanku, I resolved the issue using Format Range option with the below code
    CRITERIA    EVALUATE IN  FORMAT     USE     PARAMETERS    APPLY TO
    INPUT          ROW                1234,56      ALL                --                   DATA
    Thanku

  • DIsplaying WRBTR (AMOUNT FIELD)WITHOUT  DECIMAL PLACES

    Dear all,
    I am facing a problem in displaying amount field  in alv report. I have two currency keys (US dollar and Japan yen). if it is japan yen I should not have to show decimal places and if it is US dollar I should show decimal places.
    How can I do it in a alv report if I have only one output amount field?
    thanks
    Ranjan.

    Hi chittaramjan,
    1. use this kind of funda (just copy paste in new program)
    Important things
    a) one extra field in internal table
      declared in the same exact fashion
    waers LIKE tcurc-waers,
    b) Populate this field
    c) REST THE System will take care
       (based upon country settings)
    2.
    REPORT abc.
    TYPE-POOLS : slis.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA  : BEGIN OF itab OCCURS 0,
            f1  LIKE P0008-BET01,
            waers LIKE tcurc-waers,
            END OF itab.
    START-OF-SELECTION.
      itab-f1 = '-4.15'.
      itab-waers = 'KRW'.
      APPEND itab.
      itab-f1 = '4.68'.
      itab-waers = 'GBP'.
      APPEND itab.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name     = sy-repid
          i_internal_tabname = 'ITAB'
          i_inclname         = sy-repid
        CHANGING
          ct_fieldcat        = alvfc.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = sy-repid
          it_fieldcat             = alvfc
        TABLES
          t_outtab                = itab
        EXCEPTIONS
          OTHERS                  = 2.
    regards,
    amit m

  • Key figure, number of decimal places are not showing in report output

    Dear experts,
    At cube level PO qty value is getting 0.010 where as in bex report output of PO qty showing as 0. I have chosen decimal places as 0.000 in key figure additional properties tab. In query designer also I have chosen no of decimal places as 0.000 in display propertiesu2026please help me out. How can I get 0.010 value in report o/p.
    Thanks in advance.
    Srivalli.

    Hi,
    Try to run the query in RSRT. CHeck if you are getting the same output. Also make sure that in the reports all the filters are same as you have applied in the info -cube to see the data.
    - Jaimin

  • PO print preview displays incorrect setting in decimal places

    Dear Experts
    Please help me on the following condition.
    I have a problem in print preview of a PO. It displays the incorrect setting for decimal place in currency.
    It shows USD 1.404,00 whereby the amount should be USD 1,404.00
    This only happens to a certain vendor that is doing PO for the first time from that country
    Example:
    I'm creating a PO for vendor 123. Vendor 123 is located in country A. No PO has been created for any
    vendor in country A before. When I saved my PO, in print preview, the decimal setting is not correct.
    But when I'm creating another PO, for vendor 234. Vendor 234 is located in country B. There have been
    several POs created for vendors in country B before. When I saved my PO, in print preview, the decimal
    setting is correct.
    Both vendor 123 and vendor 234 is using currency of USD.
    Is there any other setting with the vendor master in regard with the currency decimal setting for each
    country for the vendor? Or something that I've missed out?
    Diagnosis:
    I've checked with the user profiles->default-> decimal notation. It displays 1,234,567.89 correctly
    I've also run OY04, but the decimal setting is correct.
    Thank you
    Regards
    Syukri

    this has nothing to do with print preview, it is just basic country setting (OY01) how a quantity and value is written on a PO to a vendor is country xyz.
    German uses to comma to seperate decimals, while USA uses the point to seperate decimals
    this would be the German version 1.404,00, and this the US version:: 1,404.00
    so if an American sends a PO to a German vendor, then the document will show 1.404,00 so that the German can understand that he wants 1404. (and not 1000 times less)

  • U261B An Issue due to 3 Decimal Places in Percentage - Help Required

    I've an Issue in BEX report output, which is like when I try to create a 'Percentage' computation on a Key Figure Value, I'm getting 3 decimal places as 'default' output.
    The 'Calculations' settings I made for this KF is
    > Calculate Result as ... Nothing Defined
    > Calculate Single Values as .... Normalize According to Next Group Level Result
    > [✔] Apply to results
    > Calculation Direction - Along Rows
    ☹  I ran SAP_RSADMIN_MAINTAIN and set object 'IGNORE_T006_ANDEC' to the value 'X' - Not woking! Should I choose Update/Insert/Delete??
    ☹  T006-ANDEC & T006-DECAN for '%' has 0 decimal places only. Am I checking the correct stuff?
    ☹  OSS note 866505 not helpful for my issue. BW 7.0 Stack
    I'm getting my output as expected, but the only worrying factor is 3 decimal places due to the 'Calculations'. I'm unable to resolve using existing methods. Should I raise an OSS Note for this?
    Please help...

    Hi, I posted a message to SAP on this topic and got an explanation - it is a behaviour that cannot be changed in certain cases:
    it is the known design that it is always displayed with three decimal
    places for normalized values and the setting in Query Designer for
    decimal place doesn't take effect. This is because that normalization
    changes the number dimension of this structure element.
    You may refer to below notes about more details.
    > 869135 Decimal places and scaling for "Calculate Single Values As"
    You cannot set the number of decimal places or the scaling for some
    columns or structural components.
    For 2: Some "Calculate As" functions change the number dimension of a
    KID. In this case, the scaling and the number of decimal places set for
    the KID are no longer relevant. In this case, the system ignores the
    original setting and selects a setting that corresponds to the new
    number dimension. This cannot be overwritten. The following functions
    are affected:
    Calculate Single Values as Scale to Result, Overall Result or Query
    Result: Scaling 1 and three decimal places.
    > 501930 Number of decimal places setting is not applied
    As a result, normalized values resulting from the list calculation are
    displayed with three decimal places and without scaling by default.
    best regards, thom

Maybe you are looking for

  • Why can't I see my external hard drive, Intel iMac / 500 GB, G-Drive

    Why can't I see my external hard drive?  I have a new iMac, Intel based i5, running Lion (2-3 months old).  I have a 500 GB G-Drive external hard drive that has showed up when connected to my iMac for the past 2-3 months.  Now it's gone.  It's NOT vi

  • CIN configuration Doc

    Hi Can any body provide me a document on CIN with configuration ??? Purpose of various GL a/c for CIN and entries passed in MM & SD & required stock ledger s Thanx Srinivasa Rao

  • HU routing to Staging area based on destination Storage type

    Hi Experts, I have a requirement where I need to route the HUs coming out from same VAS work center to the different staging areas according to the destination storage types. Say for example, VAS Workcenter - VAS1 HUs completed out of the VAS1 workce

  • Execute a Linux konsole command from Java

    Hy,I am having problems when trying to execute a command for konsole from java. This is a part of my code try {      Runtime.getRuntime().exec("konsole"); catch (IOException ex) {ex.printStackTrace();}this code opens the Linux konsole ; is the a meth

  • Contact sheet border

    how can i add a border to each image on the contact sheet?