Predom value Calculation

Hello All,
I'm in oralce 11gR2 RAC- 2 node. Trying to calulate a predominant value.
Predominance – Calculated value will be based on the most prevalent value that falls within the limits of the section
Here is a excerpt from the output to explain better
The below values are ordered by MIN_MSR,MAX_MSR.
MIN_MSR     MAX_MSR     VALUE
53.04     53.344     85
53.344     53.35     85
53.35     53.73     85
53.73     54.327     72
54.327     54.356     72
54.356     55.63     72
55.63     58.93     63
58.93     58.989     63
58.989     58.993     63
58.993     59.12     63
EXPECTED OUTPUT
MIN_MSR     MAX_MSR     PREDOM(VALUE)
53.04        59.12        63 (because 63 is more prevailant , 85 is the value for 53.73 - 53.04=0.69 miles, 72 is the value for 55.63-53.73=1.9 miles, 63 is the value for 59.12-55.63=3.49 miles)63 is more prevailant , 85 is the value for 53.73 - 53.04=0.69 miles, 72 is the value for 55.63-53.73=1.9 miles, 63 is the value for 59.12-55.63=3.49 miles
Thanks in advance
NU

Hi,
Here's one way:
WITH     got_rnk          AS
     SELECT       value
     ,       MIN (min_msr)          AS min_msr
     ,       MAX (max_msr)          AS max_msr
     ,       RANK () OVER ( PARTITION BY  value
                                   ORDER BY      SUM (max_msr - min_msr)  DESC
                      )        AS rnk
     FROM       table_x
     GROUP BY  value
SELECT     min_msr
,      max_msr
,      value
FROM     got_rnk
WHERE     rnk     = 1
;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test it.
This is an example of a Top-N Query , where you pick N items (N=1 in this case) from the top of a sorted list.

Similar Messages

  • How  Kernel Parameters values calculated in 10g*

    Hi to all;
    *10g Orace installation on OEL*
    How  Kernel Parameters values calculated in 10g
    kernel.shmall = 2097152
    kernel.shmmax = 2147483648
    kernel.shmmni = 4096
    +# semaphores: semmsl, semmns, semopm, semmni+
    kernel.sem = 250 32000 100 128
    fs.file-max = 65536
    net.ipv4.ip_local_port_range = 1024 65000
    net.core.rmem_default=262144
    net.core.rmem_max=262144
    net.core.wmem_default=262144
    net.core.wmem_max=262144
    Run the following command to change the current kernel parameters
    /sbin/sysctl -p
    **  "/etc/security/limits.conf"  **
    *               soft    nproc   2047
    *               hard    nproc   16384
    *               soft    nofile  1024
    *               hard    nofile  65536
    My question I think 32 bit or 64 bit OS calculation will be same only.
    I want know how it was calculated ?
    Edited by: 969352 on Feb 9, 2013 7:02 AM

    Hi
    I suggest please review:
         Relationship Between Common Init.ora Parameters and Unix, Linux Kernel Parameters [ID 144638.1]
    Regard
    Helios

  • Query regarding condition type value calculation in VA05

    Dear Gurus,
    We had maintained one condition type Z*** where we had declared the condition type as follows:
    Condition class - Prices
    Calculation type - Quantity
    Plus/Minus - A (positive).
    We had maintained the condition table as :
    Price = 200 USD per 10 EA
    Lower limit = uppler limit = 0.
    When we are calculating the price in the sales document, the system is taking the price of 10 units as 200 USD correctly.
    But in VA05 screen, the confirmed net value for 10 units is shown as 10*200 = 2000 USD which is wrong.
    Can anybody throw a light on how the confirmed net value for VA05 screen is calculated.
    regards,
    Krishna

    If it is representing the value of the condition type, then it is a new field customised by your technical team. Standard VA05 doesnot represent the value of any condition type. So please check with your developer, may be there is a problem in their program.

  • Issue in Return sales, condition value calculation.

    Hello All,
         I am creating  return sales order (order type-RE) with reference to a Billing document, and reducing the quantity while creating the sales order (Example: Ref billing quantity-60 and sales order quantity-30). Here even though the quantity is reduced to 30 PC the basic excise duty value shown in the sales order is same as in the reference billing document (with 60 PC quantity).
         In pricing procedure for condition type (basic Excise duty) calculation type used is 355.
    Kindly help me out to over come this issue.
    Regards,
    Manoj

    Your post is not sufficient to understand your requirement.  Let me know whether your client are into TAXINJ or TAXINN.  Also as requested already, share your pricing procedure screen shot.  Moreover, have you checked the Analysis screen from condition tab of that sale order ?  If not, better check there which will give a clear picture.  Finally, ensure that there is no manual condition type JMAN used in billing document in which case, as per routine 355, system will copy that value.
    G. Lakshmipathi

  • Creation of a new Formula Routine for condition base value calculation

    hello people,
    i am stuck up in a situation where SAP has itself said that nothing can be done.
    but i know you all can guide me to some way or the other
    see, the scenario is like this
    1. i have to calculate the base value for a pricing condition.
    which will follow the formula
    net value + excise duty + freight
    2. in standard routines two things are normally bieng used
    xkwert for the value that has to be finally calculated(taking reference of routine 004)
    komp-netwr for the net value
    3. i have to calculate the excise duty by adding up all the base values of existing pricing conditions like JMOP, JEC1 etc that i have which i saw in internal table
    XKOMV on debugging
    4. now freight is to be calculated from all the values of condition types that are in KOMP which is a structure and no internal table is defined in standard main program
    now ppl
    can you guide me by looking at the standard program
    what is this xkwert field and where it is assigning the value.
    how to get field from other structure and table.
    please guide as to how to approach the problem.
    thanks and regards
    Nitin

    HI,
    the scenario u r talking abt is condition based value formuls of VOFM transaction.
    here the data is retrieved as 'X' structures and will hold normal tables with respective names. and in this case all the pricing data is in KOMV ie XKOMV
    Final amount including tax
    form frm_kond_basis_004.
      xkwert = komp-netwr + komp-mwsbp.
    endform.
    always calulation is done in xkwert field and final value is stoerd in xkomv.
    *.................. text ............................................. *
    Condition base value formula to get the assessable value of the     *
    saleable material from j_1iassval. If the value is not maintained   *
    then the selling price will be taken as the base                    *
    TABLES: J_1IASSVAL.
    DATA XXKOMV LIKE KOMV .
    XXKOMV = XKOMV.
    SELECT SINGLE * FROM J_1IASSVAL WHERE J_1IWERKS = KOMP-WERKS AND
                                         J_1IMATNR = KOMP-MATNR.
    IF SY-SUBRC EQ 0.
        IF J_1IASSVAL-J_1IVALNDP NE 0.
        XKWERT = J_1IASSVAL-J_1IVALNDP * KOMP-MGLME / 1000.
        ENDIF.
        IF J_1IASSVAL-J_1IVALASS NE 0.
        XKWERT = J_1IASSVAL-J_1IVALASS * KOMP-MGLME / 1000.
        ENDIF.
    ELSE.
       XKWERT = XXKOMV-KAWRT .
    ENDIF .
    XKOMV = XXKOMV .
    ENDFORM.
    and as far as ur  req select allthe condition type data and sum and take the average value and pass it.

  • Excise Base value calculated wrongly in GR

    Dear experts,
    When preparing Bought out goods receipt in migo,excise base value is coming wrongly(not as per PO) in sometimes.
    If we come back from the screen without saving & then try again. That time the base value is calculating correctly.
    This kind of situation is arising inconsistantly. Not regularly.
    Please suggest to overcome this issue.
    Regards
    M.Sarathi

    Hi,
    When we capture excise invoice in MIGO, SAP will default the excise base value for the total PO quantity.
    For eg. if the total PO qty is 100, and if the price is 10 INR, then during MIGO, system will show 100*10 = 1000 INR.
    Even if you have posted a partial GR of say 10 nos. already, and you are now trying to post the balance 90 nos in MIGO,
    then also, system will suggest the base value as 1000 INR (instead of 900 INR). This is a bug in the excise tab.
    Only option is to overwrite the base value manually as per the GR qty.
    Regards
    Prabhu

  • Problem in Asset value calculation ... ANEP and ANLC

    Hellö ,
    We have a problem in calculation of the Fixed Asset values. Please see the link below for the problem. Technically it sums up like transaction values are available in the table ANEP but ANLC table is with the wrong value, Some of the transactions are not reflecting in the calculations of planned values for some of the Assets.
    http://docs.google.com/View?id=ddqnbgm8_49cmgq86gx
    We develop and implemented a functionality with the next
    characteristics:
    a. When we ran the MIRO transaction to a fixed asset situation, a
    substitution in accounting documents (using a user-exit ) determines
    the profit center to the fixed asset and insert the line
    item in a custom table.
    b. The custom program identifies all pending line items for processing
    (via custom table) and, for each fixed asset identified, reverse the
    original accounting document, and post the fixed asset in the profit
    center '04219CL000'. To do this movement between the profit
    center '04106CL000' and '04219CL000' the custom program uses a zero
    balance account.
    c. First of all, the custom program set the Field <negative values>
    (BAPI1022_DEP_AREAS- NEG_VALUES) using the function
    BAPI_FIXEDASSET_CHANGE. Later the custom program post the accounting
    document using the function BAPI_ACC_GL_POSTING_POST;
    d. In less than 1% of the cases the fixed asset posted in this process
    it seems with a problem: the asset line itens (transactions  - ANEP
    table) where correct posted but the fixed asset acquisition values
    (ANLC table) where posted in a wrong way (it's initialized - without
    any value sometime or not summing up some transaction values properly).
    e. Our custom program does not update any field value on the asset.
    All the modifications on the asset are being made by the standard
    functions above.
    Edited by: Ravi Sharma on Jun 17, 2009 9:16 AM

    Hi,
    the problem is: Does anybody give you the correct value for each part?
    If you know the value for each part you can use transaction ABUMN to transfer values from one asset to a new asset. With this transaction you can create a new asset. And you can make a partial transfer.
    If you use this transaction you can simulate before you transfer it.
    But as I said the problem is to find out the correct value. In germany for example we have to activate all in one fixed asset (computer with cbu )
    Hope this answer your question.
    Best regards
    Volker

  • Cumulative value calculation in script logic

    Hi,
      Assuming i have the following values:
    Acc1, time1 = 2
    Acc1, time2 = 10
    Acc1, time3 = 20
    Acc1, time4 = 30
      What script logic can i write such that the end results are:
    Acc2, time1 = 2
    Acc2, time2  = 12
    Acc2, time3 = 22
    Acc2, time4 = 32
      time1 could start from any month of the year, and the next month is always one month after the current month (i.e. if time1 = june, then time2 = july).
      Basically the above calculation involves some sort of cumulative effect. I would like to have this cumulative amounts stored in the database, hence i don't want to rely on measures="ytd" in the report.
    Cheers

    Hi Raja,
    You can get the daywise cumulative value for the user selected date range by creating a formula on the KF & turning on the 'Cumulated' checkbox in the 'Calculations' tab.
    --Priya

  • Net value calculation in pricing

    Hi Experts,
    Net value in SO and customer gross in billing showing incorrect value
    Base price inclusive of duty - 100
    So excise base value u2013 90.66 statistical condition
    ED- 9.07
    ECESS- .18
    SHECESS- .09
    The issue is net value in SO showing 109.34 (1009.07.18.09) instead of Rs.100. The same value is passing in accounting for customer gross also. I need to arrest 9.07.18+.09 to be calculated in net value and customer gross account.
    May you pls advise?
    Regards,
    Deepu Pillai

    To achieve this, you have to do backward pricing, means- After entering Total value i.e.100 in your eg. You have to derive the base price.
    like Total value ( Incl:Duty) = 100 = Base price + Duty( EdECSSHECess)
    Assume Base price = X
    100 = X + (10% of X)+(2% on 10% of X) +( 1% on 10% of X)
    ---   = X + (X/10) + (2X/1000) + (1X/1000)
    Then , you will find Base Price i.e. Base price = (Total * 1000)/1103
    If your Total = 100, then base price = (100 * 1000) / 1103 = 90.66
               ED = 10% on Base price = 10% on 90.66 = 9.07 ( 2 decimal rounding)
                ECS = 2% on ED = 2% on 9.06 = 0.18
                              SHECess= 1%onED=1% on9.06= 0.09
                                       Total = 100( Price Incl:Duty)
    So to achieve this you have to write new calculation routine & assign it in alt cal type.
    ( Create Statistical cond, type called "Total Price" & assign this cond type above the base price).
    Note: Discounts have not been taken into account, if you want discount should be taken into account, then the base price you have to assign this New routine in "Assesble value" condition type)
    Hope it helps.
    Regards,
    Reazuddin MD

  • Blanket PO - Actual Value Calculation

    Hi All,
    Can anybody tell me how the actual value is calculated for each line item in Blanket PO.(In Limit tab you can able to find Overall Limit, Expected Value and Actual Value.)
    Thanks and regards,
    Senthil.B

    Hi Friends,
    I am comparing 4.7 and ECC 6.0 EHP 4 functionalities in MM.
    I found some change has been made to Purchase requisition to save as template.
    Here is the detail in ERP browser.
    "Creation of purchase requisitions for materials.
    - Purchase requisitions can be saved as templates and templates can be used for faster creation of extensive purchase requisitions without the need of manual data entry.
    - Fast maintenance of account assignment with template functionality.
    - Personalization of user interface based on Web Dynpro"
    I could not find the option to save Purchase requisition as template in ECC 6.0.
    Kindly let me know how to activate this menu option or functionality.
    BR,
    SB.

  • Problem w. hash-value calculation for CLOB with DBMS_UTILITY.GET_HASH_VALUE

    Hello Oracle-Experts,
    I had to calculate hash-values for a corrorponding CLOB-field (see my post 'Buffer to small ORA-22835 error after migration from 9i to 10g' in forum 'database general').
    I calculate the hash-values with the DBMS_UTILITY.GET_HASH_VALUE, e.g:
         SQL> SELECT DBMS_UTILITY.GET_HASH_VALUE(LPAD('X',3998,'X'),1,POWER(2,30)) FROM dual;
         DBMS_UTILITY.GET_HASH_VALUE(LPAD('X',3998,'X'),1,POWER(2,30))
         1053896858
    Because the calculation failed with 10g I had taken a closer look at this function and realised the following results:
    VALUE                                             DBMS_UTILITY.GET_HASH_VALUE(VALUE,1,POWER(2,30))
    LPAD('X',3997,'X') 557754150
    LPAD('X',3998,'X')      1053896858
    LPAD('X',3999,'X')          888036750
    LPAD('X',4000,'X') 162062978
    LPAD('X',4001,'X')          162062978
    LPAD('X',4002,'X') 162062978
    LPAD('X',10000,'X') 162062978
    It seems to me that I can't use this function for clob-values with a length greater than 4000 characters because of collisions. Maybe someone with experience
    can give me a hint to handle this problem. Worst case i had to write my own CLOB_2_HASH function.
    TIA + Best regards
    Matthias

    Yeah, the 4000-byte limit would be a factor in working CLOBs. I if you only had 4000 bytes you would not need a CLOB in the first place.
    If you don't find something better then writing your own function might be the thing to do.

  • PO invoice value calculation

    Hi ,
    Can anyone Please share your thoughts on calculating the Total Invoice value , how much is invoiced , and how much has to be invoiced based on a Invoice receipt on Purchase order .
    Thank you .
    Regards,
    Ry

    Hi ,
    Can anyone Please share your thoughts on calculating the Total Invoice value , how much is invoiced , and how much has to be invoiced based on a Invoice receipt on Purchase order .
    Thank you .
    Regards,
    Ry

  • Excise value calculation of Assessable Value in Purchase Order

    Hi Friends,
    In a requirement, we need to calculate Excise on Assessable value maintained in J1ID transaction. We are getting excise calculated values on Net value, whereas as per requirement we need to have it on assessable value. Is there any functionality available in SAP standard system for calculating it on assessable value. We have found the same for Sales scenario, pls suggest us for purchase also.
    Rgds, Krishan Raheaj

    H,
    As SAP standard Taxes will calculate on Basic value which is correct behavior.
    Which Tax procedure you are using??
    What is the content of Assessable value does it is having any other values such as Freight, Discount based on that system has to calculate the taxes is this is your requirement?
    It is easy if you are using Tax procedure Taxinn, as you can have control in % while maintaining the condition record using FV11.  You can maintain the way you wants, assume your Basic value is 1000 BED 10% =100, ECS 2% = 2, SHE CESS 1% =1, and wants the BED value should be 120 but the Excise rate is 10% it will calculate only 100 still you can change the rate to 12% to arrive the value to 120. And so onu2026
    If you want to have it without changing the Tax rate, then you can do this by maintaining the sub total 4   in pricing procedure (OBQ3) against the condition which goes up and added to basic value (BASB) and on which system will calculate Tax.
    Rg

  • Value Calculation in Service Entry Sheet

    Hi All,
    I created the service PO for 117,130 and Discount/Quantity 61,420 and net price becomes 55,710.
    When I do Unplanned Service Entry Sheet as follows:
    Qty     1     Gross Price      12,534.75,     Value showed in GR is      5,961.85
    Qty     1     Gross Price      835.65          Value showed in GR is     397.46
    Qty     1     Gross Price      3,342.60      Value showed in GR is     1,589.83
    After accepting the service entry sheet it shows net value 7,949.13 & total value 16,713.00 in service entry sheet value tab.
    Pls explain how he it is calculating net value and total value

    Thanks for your reply, Padmasri Garapati,
    but i wanted to do the service entry sheet like mentioned below
    Qty 1 Gross Price 12,534.75, should show Value in GR 12,534.75,
    Qty 1 Gross Price 835.65 should show Value in       GR 835.65
    Qty 1 Gross Price 3,342.60 should show Value in    GR 3,342.60
    What ever value i will enter in service entry sheet and same should so in GR value in PO history.
    Not like below one:
    Qty 1 Gross Price 12,534.75, Value showed in GR is 5,961.85
    Qty 1 Gross Price 835.65 Value showed in GR is 397.46
    Qty 1 Gross Price 3,342.60 Value showed in GR is 1,589.83

  • Formula function in formula of type Rate Value Calculation does not work

    Hi,
    We are trying to prorate eligible salary based on some business rules.
    We have defined Standard rates with calculation method as 'Calculate for Enrollment Rule' and attached a formula in the 'Value Rule' field.
    Now inside the formula, if i directly return a value like 'Return 9000' , it works correctly. However, if i have a fomrula function and return the value as follows,
    l_value = CUSTOM_FF_FUNCTION()
    retunr l_value
    it does not return value.
    I have attached a package function that simply returns 4000 just for debugging.
    Even this does not return the value back to the formula
    Any pointers will be useful
    Thanks,
    LN

    Sorry. I had not checked this post earlier.
    We had 2 functions with same name and same contexts on the same database. Each of the functions called a separate package function and had its own logic.
    So sometimes the first function was called.At some other times, the second function was called.
    We deleted one of the functions and the formula worked well.

Maybe you are looking for

  • Command Sequence in Command URL

    Hello everyone.  I'm having a problem with a command sequence using the Web Template as a Web Item.  The command resets data providers TOPN1 and TOPN3 to new queries.  I have the following command sequence in a Web Template: <SAP_BW_URL DATA_PROVIDER

  • OSX Leapord Mail ?

    I recently had to remove my mail application due to a message I was getting stating that the OS hard drive was full. After removing the mail application the OS looked fine. I normally use gmail and only test my website for contact links with os mail.

  • HR : FM for Hiring action

    Hi all, I want to create an employee master data(a hiring action). Please let me know  is there any FM avail for the same(creation of Pernr). thank u.

  • ToolTip for a report

    I have a big report. and now i want to show one column as a tool tip like the one in java. this means: for every row exists a specific column, named description, which should be shown as a tool tip. Is there a possibility to realize this?

  • Build the best computer for running Photoshop, 64bit 32bit

    Hi people, the new Photoshop CS4 include new improvement who include support of Vista 64bit and GPU acceleration trough OpenGL 2 ok, so i want build a very fast computer how take advantage of new improvement dedicated to photoshop CS4. So the first q