Logic to build a New Column....

Hi Guys, I have sample data as below:
Name_____Time Bucket________# Count of Phone calls
Rob_______15 Minutes________ 2
Rob_______30 Minutes_________3
Rob_______1 hour____________2
Bobby______15 Minutes_______1
Bobby______1 Hour___________2
It is an example of our sales data....
Name is name of the Customer service rep
Time Bucket's are standard 15, 30 or 1 hour
# Count is the number of times that Sales Rep has made calls in that Time Bucket.
I have to build another column to calculate the total hours spent by each rep.
So should it be something like:
Select ((15 * Count) + (30 * Count) + (1* count)) Total Hours
from table1
Please Advise.
Thanks,
Kon

Hi, Kon,
Whenever you have a question, it helps to post:
(1) The version of Oracle (and any other relevant software) you're using
(2) A little sample data (just enough to show what the problem is) from all the relevant tables
(3) The results you want from that data
(4) Your best attempt so far
Executable SQL statements (like "CREATE TABLE AS ..." or "INSERT ..." statements) are best for (2).
Formatted tabular output is okay for (3). Type these 6 characters
{code}
(small letters only) before and after the tabular text, to preserve spacing.
This seems to be a job for "GROUP BY name".
If time bucket is a number (15, 30, 60), then its just
SELECT    name
,         SUM (time_bucket)
GROUP BY  name;If Time bucket is something else that represents 15, 30 or 60, then use CASE to map it to 15, 30 or 60.
From your description, it seems like the count of phone calls plays no role in this problem.
Do you need the average number of calls per hour, or something like that?
Post the information above if you need more help.

Similar Messages

  • How can i add to a listBox items near in a new column other items ?

    The items on the right i changed the property of the listBox1 righttoleft to Yes.
    My problem is i want to build a new column for the number so each number i'm adding will be next on the left to the belong item string. And not under it like now.
    1. Maybe i need to use another control and not listBox ?
    2. How can i add column/s and also maybe adding a title to each column like: Names Id Number....?

    If you want columns, you should consider a
    ListView or
    DataGridView.

  • New column - all-time rolling sum in Repository

    Hi all
    I need to build a new column in the repository.(ALL TIME ROLLING SUM TO DATE) and # Month Roll over on that.
    I am looking for a way to easily compute rolling sums (etc.) for ranges of dimensional values that are not included in the result set.
    I want to show a table of monthly unit count for 6 months:
    I have the values forall months ,starting from years 2000.
    Month unit Count
    Jan07 100
    Feb07 150
    Mar07 - 100
    Apr07 125
    May07 - 200
    Jun07 210
    In another column I want to show an all-time rolling sum of the transaction activity
    (sum the metric for all rows in the fact table <= the month in the row of the report).
    Month Unit Count Rolling Sum To Date (Balance) 3 month Rollover
    Jan07 100 3400
    Feb07 150 3550
    Mar07 100 3650 10600
    Apr07 125     3775 10975
    May07 200 3975 11400
    Jun07 210 4185 11935
    I tried RSUM for Rolling Sum To Date, but it dosent give rolling sum values above the considered result set time period.
    Immediate help is appreciated, kind of urgent help required.
    Thanks in advance.
    Edited by: user11939829 on Sep 16, 2010 10:20 AM

    Hi Deepak,
    When i gave the example i forgot to add that i am showing the pivot chart in the report and showing the RSUM in Line Graph for 3 years..where i have year at the column and i have one dimension at the page section of the prompt.
    So i m just showing the line graph where i have RSUM at the Vertical axis...Month at the horizontal Axis.
    Sorry for the confusion

  • Adding new column in an existing report which was build using Union

    While working in OBIEE 11g I encounter an issue.
    My existing report was build using UNION at Criteria Tab in Analysis. Now I have a requirement to add a new column into the same report. For each criteria I have added the new column but when I go back to the "Result Columns". I see a new field added but it is not allowing me to open or edit column properties for that new column & at the same time it is not allowing me to navigate to other tabs like Results, Promts, and Advanced.
    I don’t want to build this report from scratch. Is there any workaround to get it resolved?

    Hi,
    Just check it once the new added column data types are mismatched or not?
    and the new added column should be navigated into excluded section, so u should edit the report and dragged into the table column section.
    Thanks..

  • New column based on four logical measure column

    Hi All
    I have four logical measure column which each one indicate how many activity under each service request.
    ie value of each column is
    col1 - 1,
    col2 - 2
    col3 - 3
    col4 - 4 activities or more
    Based on this can i create a new measure column, whenever any service request has two activitiy, my new column should show 2 (ie value col2)
    can i do the max of all the four columns or how to approach this issue?.
    Thanks

    Yes, this is little bit complicated.
    Since there is no direct SQL which extracts the number of activities under each Service Request in the existing setup. They used the nbr of rows in activity in relation to service request table. This way they calcuate the nbr of activities under each SErvice request.
    In the previous request, business want to see how many Service request with one activity or two activties. Because of this, four logical column have been created.
    Now My request need to see service request with one activity or more than one activity measure in the drill report. Since i have already show that nbr of service request with one activity or more than one activity in a chart format.
    Instead of showing all the four measure in my drill report, i want to show if a service request has got one or more than 1 activity.

  • Can we add a new column in report which is not in table.

    Hi All,
    Can we create a new column in report which is not in table.
    I have two columns in my table completion_date, manufacture_date. If the difference between the completion_date and manufacture_date is 0, -1, 1 then the new column of the report will say on time against each record or else will display late. Any suggestion how to proceed on this
    Regards
    Edited by: User_Apex on May 16, 2011 5:54 AM

    Standard report then, NOT an interactive report (which if you were using, you could build a computation and report on that)..
    Then the adding a column in the query would be your best best...
    Thank you,
    Tony Miller
    Webster, TX
    There are two kinds of pedestrians -- the quick and the dead.
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Issue adding a new column to OBIEE presentation layer

    Hi,
    I am pretty new to OBIEE so this may be a silly question. I am facing some problems trying to add a new column from a physical table the OBIEE presentation layer.
    Below are the steps I followed:
    Task: add a product category set to the presentation layer.
    Steps:
    1) First verified that the product category set is being populated in the W_PROD_CAT_DH table in the datawarehouse. this was done by running the following sql
    SELECT W_PROD_CAT_DH.TOP_LVL_PRODCAT_NAME
    FROM W_PROD_CAT_DH, W_INVENTORY_PRODUCT_D
    WHERE W_PROD_CAT_DH.integration_id = W_INVENTORY_PRODUCT_D.INV_PROD_CAT1
    This sql gave the right category value.
    2) created a "Alias" of the table W_PROD_CAT_DH in the OBIEE Admin tool physical layer. (done by right clicking W_PROD_CAT_DH >>New Object>> Alias)
    3) named the Alias of W_PROD_CAT_DH as "Dim_W_INV_MKT_CAT" and created a key of the alias named "integration id" on the column "integration_id"
    4) opened the pre-existing alias of W_INVENTORY_PRODUCT_D the alias was called "Dim_W_INVENTORY_PRODUCT_D" and added a key called "MKT_CAT" on the column "INV_PROD_CAT1" in this alias (Dim_W_INVENTORY_PRODUCT_D of the table W_INVENTORY_PRODUCT_D)
    5) in the alias of the "W_INVENTORY_PRODUCT_D" called "Dim_W_INVENTORY_PRODUCT_D" added a "Foreign Keys" the expression of the key is following: ("Oracle Data Warehouse"."Catalog"."dbo"."Dim_W_INV_MKT_CAT"."INTEGRATION_ID" = "Oracle Data Warehouse"."Catalog"."dbo"."Dim_W_INVENTORY_PRODUCT_D"."INV_PROD_CAT1")
    Logical layer
    6) Opened the existing logical folder called "Dim - Inventory Product" and clicked on "Sources" tab then double clicked the source "Dim_W_INVENTORY_PRODUCT_D" and added a new mapping under "Map to these tables" under "General" tab. The column that was added was the physical alias "Dim_W_INV_MKT_CAT"
    7) added a new column mapping to the same logical table source (Dim_W_Inventory_PRODUCT_D) this new mapping was a column from the alias "Dim_W_INV_MKT_CAT" (column name "TOP_LVL_PRODCAT_NAME")
    Presentation Layer
    8) dragged the newly added column (TOP_LVL_PRODCAT_NAME) from the logical layer "Dim - Inventory Product" to the presentation layer "Product" folder.
    ISSUE
    after adding everything and checking global consistency and save and checking-in my work when i login from the front end presentation services. I see the newly added column is showing under the "Product" folder. on dragging the column by itself to the Ad-Hoc analysis I can see the different values of the category. On adding a second column from the same logical folder (Dim - Inventory Product in logical layer) i still see the right product name and corresponding category. BUT when I drag any other column from any other folder (such as "Day" from "Time" or any fact values) the result does not fetch any data (message: The specified criteria didn't result in any data.)
    I am not sure if I am missing any step but I know I am mapping the new table alias to the inventory_product_d since i see right results on creating analysis of columns in those two folders. but no other folders give me any data.
    I also know that the logical folder "Dim - Inventory Product" is joined with other tables as I can see results when i do not add the newly added catagory column but other folder and other columns of "Dim - Inventory Product"
    I would really appreciate any insight to this very much. we are using OBIEE 11.1.1.6 with the Oracle 11.5.10 Adaptor (SDE_ORA11510_Adopter)
    I will try to upload some screenshots if needed but presently not sure if its something really simple.

    Hi Prassu,
    thanks for the responce. and Apologies for the delay in getting back to you.
    1) 1.First of all set the logging level to 3 in the admin tool save it.
    You can get the SQL query from here
    settings(Answers right top)-->Administration-->manage sessions-->view log
    When I try to do this I get the following message. and no log files.
    Error
         Log Could Not Be Retrieved
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 27002] Near <3790667783>: Syntax error [nQSError: 26012] . (HY000)

  • How to add a new column in between two other columns

    I need to add a new column in between two other existing columns. Does anyone know how to do that? The ALTER statement adds the column at the end. Can someone give an example.
    Thanks
    Murali
    null

    There is no simpler way of doing this because it is not strictly necessary: you can always see your data in the order you want simply by going SELECT col1, col2, col98, col4, etc. Thus the column order only matters when you execute SELECT * FROM...
    If that really is important enough to you you'll have to drop and re-create the table, for which there are a number of different strategies.
    Your final comment suggests that you don't retain your database build scripts. If you did then rebuilding your constraints would be painless. There is a lesson there. The good news is that if you have TOAD (download from www.quest.com) you can generate DDL scripts from your existing schema.
    HTH, APC

  • Adding a new column in the universe

    Hi Experts,
    I have a BEx Report on which the universe is based on.
    I need to have an extra column (week number) which will have numeric values, and for each additional row it will have a cumulative number.
    Col1   Weeknumber    col2
    xxx         1              yyy
    xxx1       2             yyy1
    xxx2       3             yyy3
    It would be a formula key figure in Bex.
    But,I am not able to implement this col in Bex as the query is complicated and in Bex we have a restriction that we cant have more than 2 key figure structures.
    Please let me know how this can be achieved at Universe level or Webi level.
    Thanks
    El

    Welcome to the sometimes frustrating world of working with dates against SAP BW via BusinessObjects!
    Your best bet here is to have a financial calendar table in a database and build a new query against that. Return Week Number as a detail of date and then merge the date dimensions.

  • Add new column to a jtable by pressing a button

    Hi
    I am writing a program that have Jtables and user can add one or many columns to one of those Jtables by pressing a button and that column type user can select by from a combo box.
    there have to be column types for select integer type,float type,String type or jcomponent
    I need you help to make that specific jtable

    Hi pro_udara,
    It can be done this way : while treating the mouse event, you just build a new table model and you refresh your JTable with the new model.
    See how to [*create a table model*|http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#data]

  • Generate DDL - change is a new column and I want to generate a alter table

    Morning all,
    I have searched and looked all over the data modeler and I cannot find this option ... yet I did find it easily in Designer.
    I hope you can help me.
    SQL Developer Data Modeler v3.0.0.665.
    I have added a new column to a table and when I generate the DDL I would like it to be an alter table add column rather than a create table.
    This feature is in Designer so I would think it would be in data modeler.
    Just incase my description is not clear here are the high level steps so it is clear.
    1. create the logical model
    2. create the relational from the logical.
    3. create the physical from the relational.
    4. generate DDL and run in database. At this point I go to production with my system and all is well.
    5. At this point we have an enhancement request. For the model it will be a new column in a table.
    6. update logical model.
    7. update relational from logical
    8. update physical from relational
    9. generate DDL. Here I would like to have the generate be aware the it needs only to generate an alter table add column and not create the table.
    This is something I do alot as all my models are in production. I cannot find how to do this step of getting data modeler to generate the alter.
    Designer does this exceptionally well.
    Quite often it is more than a single column. The changes can be many and made over time and at the time of generating the DDL you may not recall every single change you made. To have the tool discover those changes for you and generate the appropriate DDL is a feature I regard as very high.
    I hope this is clear and you can help me.
    Cheers
    Chris ....

    Hi Chris,
    you need to compare your model against database - import from database into same relational model and use "swap target" option - in this case "alter statements" against database will be generated.
    You can look at demonstrations here http://www.oracle.com/technetwork/developer-tools/datamodeler/demonstrations-224554.html
    Probably this particular one will be most helpful http://download.oracle.com/otn_hosted_doc/sqldev/importddl/importddl.html
    Soon or later your changes will require table to be recreated and you'll need to backup your data - you can consider usage of "Advanced DDL" option - script will be generated that will unload the content of your table (including LOBs) to file system accessible from database and restore it after changes. Well don't try it directly on production system :).
    Philip

  • ALV Table and dynamic new column

    Hi,
    I have a ALV table with tree in one column (reccuring context value).
    I would like dynamically to add new columns. I know the method of IF_WD_CONTEXT_NODE_INFO->ADD_NEW_CHILD_NODE, but this is used in another posts/blogs where whole table is generated dynamically. I have a table already and just want to add a new column.
    Is that possible?
    Thank you on advance, cheers.

    Under normal circumstances you could use the Context API method ADD_ATTRIBUTE to create a dynamic attirubte:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/af/cb744176cb127de10000000a155106/frameset.htm
    Unfortunately this is not compatible with the ALV. The ALV only supports static attributes.  Therefore you will need to build up an entire RTTI based structure in memory and then dynamically re-create the entire context. This is a similar example:
    data:
             rootnode_info type ref to if_wd_context_node_info,
             dyn_node type ref to if_wd_context_node,
             dyn_node_info type ref to if_wd_context_node_info,
             tabname_node type ref to if_wd_context_node,
             current_tablename type string,
             tablename type string,
             struct_type type ref to cl_abap_structdescr,
              table_type  type ref to cl_abap_tabledescr,
              comp_tab    type cl_abap_structdescr=>component_table,
              comp        like line of comp_tab,
              my_table    type ref to data,
              my_row      type ref to data.
        loop at field_details assigning <wa_detail>.
    * build a structure description from the list of single fields
              comp-name = <wa_detail>-field_code.
              comp-type ?= cl_abap_datadescr=>describe_by_name( 'STRING' ). "Replace with your dataType
            append comp to comp_tab.
          endloop.
    struct_type = cl_abap_structdescr=>create( comp_tab ).
          dyn_node_info = rootnode_info->add_new_child_node(
             name                   = 'MDM_DATA'
             is_mandatory           = abap_false
             is_mandatory_selection = abap_false
             static_element_rtti    = struct_type
             is_multiple            = abap_true
             is_static              = abap_false ).

  • Add New Column in ALV Report of Standard SAP ME28.

    Hi anybody,
    I want add new column in alv report of standard SAP Program ME28 Screen.
    Add Last PO Price column inside ALV Report ME28 Screen.
    Can u please anybody tell me how to add new column in ME28 Screen.
    Thanks
    S.Muthu.

    Try to find any BADI for the same
    Follow the below steps to find out what all BADI's are called when you press any button in any transaction.
    1) Goto se24 (Display class cl_exithandler)
    2) Double click on the method GET_INSTANCE.
    3) Put a break point at Line no.25 (CASE sy-subrc).
    Now
    4) Execute SAP standard transaction
    5) Press the required button for which you need to write an exit logic, the execution will stop at the break point.
    6) Check the values of variable 'exit_name', it will give you the BADI name called at that time.
    7) This way you will find all the BADIs called on click of any button in any transaction.
    OR
    Also one more option is to copy ME28 and, make modifications to the copied program.

  • Add new Column in Admin Tool including SQL Code

    Hi all,
    I'm new at OBIEE and I already searched here in forum but didn't found an exact answer what could help me.
    I have a table in Warehouse where I get the employee information. That is employee_id, manager_id and name.
    Example:
    Employee_ID Manager_ID Name
    1 Mueller
    2 1 Meier
    Now I would like to create a new column in BI Admin Tool Business Mapping Layer and add a SQL there to select the name of the Manager.
    Is that possible? And how can we do it? Will it work with a new logical column? Where can we add the SQL Code?
    Hope somebody can answer my question!
    Thanks a lot!
    Regards,
    David

    Hi Alastair,
    thanks for your answer. Unfortunately it was not exactly the answer to my question. I try to explain it again.
    In phyiscal layer I have the table with Employee_ID, Manager_ID and Name. That I already draged to BMM.
    Like I wrote before here is the example again:
    Employee_ID: 1
    Manager_ID: NULL
    Name: Mueller
    Employee_ID: 2
    Manager_ID: 1
    Name: Meier
    If I create a report in Answers then it will show the following:
    Name: Mueller
    Manager: NULL
    Name: Meier
    Manager: 1
    Instead of 1 (the manager ID) I would like to display the Manager Name. In this Example Mueller should be displayed as manager of Employee Meier.
    To do this I think I need a query like "select name from TABLE where employee_id = manager_id"
    My question is now: How can I create this logic in BMM? I don't want to do this in Answers.
    I think there should be a possibility. My idea is to add a new logical column in BMM and add the SQL Code there. But I don't know how I can add the SQL and where I have to add it.
    Please help me to solve that issue.
    Thanks!
    Regards,
    David

  • How to make new column of Interactive Report permanent

    Hi,
    after changing the query of an interactive report (adding a new column) you have to add the column from the Actions Menu -> Select Columns function of the report.
    But this change isn't permanent. After i logout and login again, or a user goes to the specified report, the column isn't visible.
    Is it possible to make this permanent, because the only solution i have found it to recreate the report, which is not a good idea.
    Thank you.
    Teo
    Edited by: temm on Sep 14, 2011 11:21 AM

    Hi,
    Login to Apex builder. Run page where you have IR.
    Select columns you like display. Then from action menu save report default layout.
    Regards,
    Jari
    Edited by: jarola on Sep 14, 2011 11:23 AM
    See documentation
    http://download.oracle.com/docs/cd/E23903_01/doc/doc.41/e21674/bldapp_rpt.htm#sthref1287

Maybe you are looking for

  • File opening multiple times in a book

    Hello. Something has gone crazy in indesign for me. Not sure if its the recent update. In osx if you open a book and double clikc one of the files, it opens, if you double click it again, it opens another copy, changes made in one reflect in the othe

  • How do i get my contacts from my ipod to my textplus account

    i need help getting my contacts back on my textplus account

  • Flush back utility

    Hi experts, can flushback utility revert database back to any point of time? or it is related with automatic undo management statistics like.. UNDO_RETENSION initialization parameter? Regards, SKP

  • Prints too dark after moving to vista 64 bit home premium

    Hi, I have a photosmart d7360 printer that used to produce brilliant prints when i had windows XP. I have since purchased a new PC with vista 64 bit home premium and my prints are now very dark. Can anyone please suggest a solution?? thanks.

  • UPgrade to Tiger or forget it?

    Help. I've got an ibook G4. 800MHz, 640 MB DDR Sdram...133 bus speed. 256. Safari keeps crashing etc. What would the advantages/benefits be to upgrade to 10.4 Tiger? Is it even worth the cost? Or should I just save up and get a new mac book when I ca