Requires Ratio based on product

Hi every one
my oracle version 10g
we have three tables required Buy_Sell_Ratio.
table 1 is trade, table 2 is currency, table 3 is product
Trade as (select 1 trade_id, 110 trade_size, to_date('01/02/11',' dd/mm/yy') trade_date, ’AA’ source from dual union all
select 2 trade_id, 80 trade_size, to_date('25/01/11',' dd/mm/yy') trade_date, 1 buy_sell_indicator, 1 product_id, 2 currency_id from dual union all
select 3 trade_id, 210 trade_size, to_date('17/01/11',' dd/mm/yy') trade_date, -1 buy_sell_indicator, 3 product_id, 1 currency_id from dual union all
select 4 trade_id, 150 trade_size, to_date('15/02/11',' dd/mm/yy') trade_date, -1 buy_sell_indicator, 2 product_id, 2 currency_id from dual union all
select 5 trade_id, 260 trade_size, to_date('20/12/10',' dd/mm/yy') trade_date, 1 buy_sell_indicator, 4 product_id, 3 currency_id from dual union all
select 6 trade_id, 320 trade_size, to_date('15/12/10',' dd/mm/yy') trade_date, -1 buy_sell_indicator, 2 product_id, 1 currency_id from dual union all
select 7 trade_id, 100 trade_size, to_date('25/01/11',' dd/mm/yy') trade_date, 1 buy_sell_indicator, 5 product_id, 1 currency_id from dual union all
select 8 trade_id, 260 trade_size, to_date('10/01/11',' dd/mm/yy') trade_date, 1 buy_sell_indicator, 1 product_id, 4 currency_id from dual union all
select 9 trade_id, 200 trade_size, to_date('25/11/10',' dd/mm/yy') trade_date, -1 buy_sell_indicator, 2 product_id, 2 currency_id from dual union all
select 10 trade_id, 200 trade_size, to_date('05/01/11',' dd/mm/yy') trade_date, -1 buy_sell_indicator, 3 product_id, 1 currency_id from dual union all)
Here Buy indicates “1” and sell indicated “-1”
Currency as (select 1 currency_id, ’USD’ symbol from dual union all
select 2 currency_id, ’EUR’ symbol from dual union all
select 3 currency_id, ’GBP’ symbol e from dual union all
select 4 currency_id, ’CHF’ symbol from dual union all
select 5 currency_id, ’AUD’ symbol from dual union all
select 6 currency_id, ’CAD’ symbol from dual union alll)
Product as (select 1 product_id, ’AA’ product from dual union all
select 2 product_id, ’AB’ product from dual union all
select 3 product_id, ’AC’ product from dual union all
select 4 product_id, ’AD’ product from dual union all
select 5 product_id, ’AE’ product from dual union all
select 6 product_id, ’BB’ product from dual union alll)
result would be in year to date (B indicates Buy, S indicates Sell, Volume indivates Trade_size)
Buy_USD     -->Total Volume of Buy in USD Curr
Sell_USD     --->Total Volume of Sell in USD Curr
Total_USD     --->Total Volume Buy & Sell in USD Curr
B_S_Ratio_USD -->     If B>S then Abs(B Volume /S Volume) , else if S>B then ( S Volume / B Volume) in the product
Buy%_USD     --->Percentage of the Volume Buy in the product Vs the Total Buy Volume YTD
Sell%_USD     -->Percentage of the Volume Sell in the product Vs the Total Sell Volume YTD
Total%_USD -->Percentage of the Total Volume traded in the product Vs the Total Volume YTD
No_of_Issues_USD -->     No of products involved YTD in the product
Product—B_S_Ration_USD—Buy%_USD—Sell%_USD—Total%_USD—No_of_Issues_USD
AA-----------------------------------
AB------------------------------
AC-----------------------------------
AD--------------------------------------
AE------------------------------------
BB-------
Could some one assist me to dtat like this.
Any assist would be appreciated
Thanks in advance
Edited by: Megna on 10-Mar-2011 23:22

Hi
i have tried like below sql but not getting Count & B_S_Ratio
select product,
sum(case when Buy_sell_Indicator=1 and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end) as Buy_USD,
sum(case when Buy_sell_Indicator=-1 and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end) as Sell_USD,
sum(case when Buy_sell_Indicator in(1,-1) and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end) as Total_USD
--count(decode(c.symbol,'USD'),i.instrument_id) No_of_Issues
--case when sum(case when BuysellIndicator=1 and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end)>sum(case when BuysellIndicator=-1 and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end) then
sum(case when BuysellIndicator=1 and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end)/sum(case when BuysellIndicator=-1 and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end) else
sum(case when BuysellIndicator=-1 and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end)/sum(case when BuysellIndicator=1 and to_char(t.trade_date,'yyyy')=to_char(sysdate,'yyyy') and c.symbol='USD' then t.trade_size else 0 end) as "B_S_Ratio"
from
Product i,
Trade t,
Currency c
where i.Product_id=t.product_id
and c.currency_id=t.currency_id
GROUP BY product

Similar Messages

  • Inspection plan selection based on production workcenter for Inspection typ

    Dear QM Guru's,
    I have requirement of automatic inspection lot creation based on production work center.
    For example :- I have Inspection Plan A, Plan B and Plan C for Material XYZ. My requirement is that, when inspection lot created for material XYZ ,when we release production order (Early lot creation) , it should create inspection lot based on production work centers in the order. In this case, if production workcenter A is in the prodiction order, system automatically assigned inspection plan A, when workcenter B,it should choose inspection plan B and same for C workcenter.
    Can we have this set up in the system?
    Let me know if u need any other details.
    Thanks in advance.

    The workcenters in QM and PP don't have to be the same.  In the user exit your going to code in the logic you want to use to select the inspection plan.
    I suggested creating the workcenters the same and the code can use that info to match up the correct task list group to assign the inspection lot. But if that doesn't work pick something else.
    Your code can use any logic you want.  You can put a description in the short text if you want. 
    You can just have an understanding that task list group 10 is always used for production work center XYZ and task list group 20 is always used for production work center ABC and task list group  30 is always used for production work center 123.  In the user exit you check which production line and just change the group to 10, 20 or 30 then.
    I don't care what you pick or how you do it, neither does the function module.  I believe the function module will pass in the parameters of the task list it is planning to assign.  You then have the ability to use the code to pick a different one and pass back new parameters for the task list.
    Craig

  • Userexit for updating sales order user status based on Production Order

    Hi.
    My clients requirent is
    Sales order user status should get updated based on production order creation,GR for PO creation etc.
    Basically depending on PO & GR For PO,various user stauts in sales order should get updated.
    Can you please suggest me some userexits in PP for this requirement?
    I am a SD Consultant and not having much idaes about PP
    Thanks
    Nisha

    hi,
    if you are not going to update it in the SO..
    then you need different exits as those are different transactions.

  • Availability of products based on product status

    Hello
    I have the following requirement that needs to be implemented in CRM 7.0.
    "Based on product statuses, we'd like to stipulate which product can be used for new orders and which products can be used only for change orders."
    For example let's say product X was created on Jan 1 2009.  Quotes/Sales orders were created for this product.  Buit in June 2009, this product should only be available for change orders.  It should not be available for new quotes/sales orders.
    I've looked through product statuses and read several posts on this forum. But I didn't quite understand what thought process I should have to implement this.
    Any guidance would be greatly appreciated.
    Thanks

    Thanks for your reply.  I see what you're saying.  The product status would still be active.  Otherwise the product won't be available for use at all.
    If that is the case, then which attribute of the product could I use/should I use, to prevent the product from being used on new orders (but usable on change orders)?
    Thanks

  • BOM Explosion based on Production Order Creation

    Hi PP Guru,
    My client wants the BOM Explosion date to be based on Production Order creation date. Could you help to advise how to set-up this requirement?
    I have showed them these possible System Configuration in BOM explosion, but none of these options are applicable to their current business practice.
    <OPPQ> BOM Explosion:
         BOM explosion number/order start date
    1     Order start date
    2     Order finish date
    3     BOM explosion number/order start date
    4     BOM explosion number/order finish date
    Looking forward to you reply.
    thanks,
    John

    Hi Sundaresan,
    Thanks for your reply.  So do you think there's any other way to fulfill the client's requirement?  I was thinking to do the "PP Master Data" instead, in order to choose the date of explosion.
    Actually the scenario is this:
    Initially the Material XXXXXX has a valid BOM on 03.01.2011 to 12.31.9999, but then, some changes has been made, maybe the user has changed the component or added new component using 04.01.2011 to 12.31.9999 as validity date.
    For example, the user created the Production Order (manually in CO01 or from Planned Order conversion) on 03.20.2011 and the Order Star date is 04.01.2011, so the system will copy the updated BOM which is valid on 04.01.2011 to 12.31.9999 (based on Order Start date).
    However, the client wants to explode the previous BOM instead (03.01.2011 to 12.31.9999).
    Please advise.
    Thanks,
    John

  • In Adobe Bridge when I try to open my camera raws, I get a pop up box stating "Bridges parent application is not active.  Bridge requires that a qualifying product has been launched at least once to enable this feature"  What do I do? Please advise

    In Adobe Bridge, when I try to open my camera raws, I get a pop up stating"Bridges parent application is not active.  Bridge requires that a qualifying product has been launced at least once to enable this feature."  What the heck?  I have a PC and haven't had problems before.. I have adobe cloud and pay my monthly bill...

    Have you opened Photoshop or any other Adobe app that Bridge works with?  You need to do this if you've upgraded PS or just signed up for CC.

  • How do I get rid of the security warning for disc based Flash product

    I have a project that use a program called Articulate to turn
    powerpoint shows into a more rich flash product with audio, search
    capacities, quiz etc. There are multiple sections from multiple
    powerpoint files that generate a dozen or so flash files. The flash
    files reside in an html shell to allow for navigation. The whole
    thing is delivered on disc as a browser based training product.
    The problem is that viewing flash from a disc results in a
    security alert every time the viewer goes to a flash file. There is
    an Articulate theme blog that suggests using a product called
    server2go to make the disc function as a server to kinda fool
    browsers on the local machine into thinking the disc is a web
    server. My client wants the product to allow the users' default
    browser. So far, although server2go is supposed to allow this, it
    doesn't with the latest version of firefox (client's preferred
    browser). I can only get it to work on a select machine or 2 in my
    office with IE (server2go default) but it takes forever to launch.
    I haven't gotten it to work on any of the client's machines. The
    disc (auto launch) just freezes the machines.
    Can anyone recommend a better server emulation product, or
    tell me another solution to delivering a disc based flash product
    without getting the security warning and without making the viewer
    change settings on their machine to allow flash to play?
    I understand security issues but this makes flash virtually
    unusable for this application and I'm dead in the water if I can't
    fix it.

    Sorry, Ralph has already answered your question. If you need to get your security questions reset, you will have to contact iTunes Support:
    ACCOUNT SECURITY CONTACT NUMBERS
    Cheers,
    GB

  • Bridge will not now let me use camera raw, though I had been using it every day.  It says that "the parent application is not active.  Bridge requires that a qualifiying product has  been launched at least once to enable this feature."  What am I to do?

    Bridge will not now let me use camera raw, though I have been using it every day.  It ways that "the parent application is not active.  Bridge requires that a qualifiying product has  been launched at least once to enable this feature."  What am I to do?

    Usually this points to having some kind of earlier trial version still installed on your system. However without more details you are not likely to find an answer. Try this for a start:
    How To Get Help Quickly

  • Camera Raw editing requires that a qualifying product has been launched at least once to enable this feature - Can someone help me I'm on a Macbook Pro 2013 with CS6?

    I get this error message when I try to use Camera Raw in Bridge - all my other adobe products work fine. "Camera Raw editing requires that a qualifying product has been launched at least once to enable this feature"  I have a 2013 Macbook Pro - I have also updated all the know adobe updates online.

    Just a clarification in general:
    BOILERPLATE TEXT extracted from the FAQ:
    https://forums.adobe.com/thread/375816?tstart=0
    Do not be abusive or aggressive in your tone
    An aggressive, demanding, accusatory or abusive sounding post will often evoke an aggressive or abusive and unhelpful reply.
    Remember, you are not addressing Adobe here in the user forums.  You are requesting help from volunteers users just like you who give their time free of charge. No one has any obligation to answer your questions.

  • When I highlight photo's in bridge and then click open in camera raw this message comes up... Camera Raw Editing Is not enabled...Camera raw editing requires that a qualifying product has been launched at least once to enable this feature. I have used cam

    When I highlight photo's in bridge and then click open in camera raw this message comes up... Camera Raw Editing Is not enabled...Camera raw editing requires that a qualifying product has been launched at least once to enable this feature. I have used camera raw a different way but it won't seem to work with bridge.

    Have you opened Photoshop or any other Adobe app that Bridge works with?  You need to do this if you've upgraded PS or just signed up for CC.

  • Camera Raw editing is not enabled.Camera Raw editing requires that a qualifying product has been lau

    Camera Raw editing is not enabled. Camera Raw editing requires that a qualifying product has been launched at least once to enable this feature.This appears when the open in camera raw disc is clicked in bridge. any solutions??

    Hi,
    Open Adobe Photoshop first. Open a Camera Raw file in Photoshop.
    Then open Bridge from within Photoshop from File> Browse in Bridge.
    Then try to open Raw files in Bridge. That should work.
    We need to launch the parent product of Bridge first ( in this case Photoshop). Then we need to open the images in Bridge and it should work normally. 
    Thank you,
    Dipanjan Das

  • "Camera Raw Not Enabled" Camera Raw editing requires that a qualifying product has been launched at least once to enable this feature.

    I upgraded my computer yesterday to a Mac Mini 2014 from a Mac Mini 2011. Restored the drive from Time Machine.  The message I received when trying to use Photoshop was I had to many computer enabled. The option was to disable the other two and use this one, which I did. I tried to open a JPG in ACR and got the message "Camera Raw Not Enabled" Camera Raw editing requires that a qualifying product has been launched at least once to enable this feature". If I open a Canon RAW file Adobe Camera Raw opens normally. Stumped.
    Jack

    The problem cleared itself. Don't  have a clue why.
    Jack

  • Get Division based on Product

    I have created one material using COMMPRO1 transaction and i have assigned Division for it.
    Now i want to know where that division gets stored...so that i can retrieve the division based on product guid.
    I want the table name for fetching the division based on product..
    Poits are sure....

    Hi
    as per my knowledge Org data which contains division and Product hierchy should match otherwise mismatch or data in consistency between division and product hierarchy occus.
    So go to division or product field place mouse there F1 then go to technical data there you will find table name,label name,field name from table it is coming.
    reward if helpful
    regards

  • BAPI for displaying materian/description/Bin storage/ qty based on producti

    Hii All,
    please gv which bapi we use to display Bin storage, Material n qty based on production order number
    its very urgent

    Hi,
         You can try with user exit MWMBAP02
    <b>Reward points</b>
    Regards

  • Backend POs based on product category

    Hello all,
    SRM 4.0, R/3 4.7, classic scenario
    inquiry if it is possible somehow to create from single shopping cart several backend POs based on product category.
    We have one SC with several product categories, would like to have several backend POs with one product category in each.
    TIA
    Gordan

    didnt gey any reply so closing the question...

Maybe you are looking for

  • Labview 2011 on Win7, OS causing serial loopback message corruption when clicking on top of windows?

    I'm wondering if anyone else has seen problems like this. I've been tearing my hair out over debugging some code. I have a ftont panel, I'm using some LEDs to send messages through the NI RS232 cable I bought, and have connected with a connector in a

  • ITunes Library search won't find song actually in library

    i have the problem with iTunes 7.5 it won't find some of the songs in my library when i search them. i can see them in the library, but when i type a word from artist or album it won's show anything. any ideas? also, why doesn't the album cover chang

  • Bind Pivot SelectedIndex causes app random crash in WP 8.1 universal app [MVVM Light]

    I have an universal app for WP 8.1 with a page and a Pivot in it. The "SelectedIndex" property of the pivot is bind to a property in the VM like this (code in MainViewModel.cs): public object SelectedPivotIndex get { return this.selectedPivotIndex; }

  • Err: workarea is not long enough...

    Hi all, Please solve this problem....... Used this Statement in FM.... INSERT zdsd_hh_rahd FROM TABLE lt_rahd_delete. Where 'zdsd_hh_rahd' is a Transp. Table with 25 fields. 'lt_rahd_delete' is declared as: DATA: lt_rahd_delete        TYPE /dsd/hh_ra

  • Another Random Shutdown Thread!

    Hey all So, ive got the random shutdown prob. Ive downloaded the firmware update and when I go to install it im told its not needed, I tried the battery update..and still the prob persists. Is it just that my battery is a dud? Thanks ! Kasra