Implementing a distinct within a sum in OBIEE

Hi All,
I am attempting to create a report in OBIEE with the following logic : -
select sum (measure),type, id, year from
select
distinct measure, type, id, year
from table A
group by type, id, year
I realize that OBIEE performs the inline view by default but how to do I perform a summation over this inline view ?
Any help would be greatly appreciated.
MN

MN,
See this
http://gerardnico.com/weblog/2009/05/12/densification-with-obiee-logical-sql-spare-to-dense-data/
or
Inner Query
Stimulate Nested query in OBI
thanks,
Saichand.v

Similar Messages

  • Help with implementing Swing GUI within jpg image

    Dear Java Experts,
    I have a question, is there a way to implement java swing objects (ie jbutton, jcombobox, etc) within an imageicon. Basically, i am trying to juggle between ways of getting JSwing GUI into a background jpg image. Please help me. I thank you all in advance.

    You've it back to front.
    Create an transparent extension of JPanel that paints an image on it's
    background before running it's super class paint method.
    You'll need to extend this example to stretch, center or tile the image
    but otheriwse it's complete.
    BTW - you have to pass an argument to this example that is the path of
    the image you want on the background of the panel, like:
    java -cp <whatever> MyJavaProject1 images/something.gif
    Enjoy.
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    public class MyJavaProject1
         static class BackgroundPanel
              extends JPanel
              private ImageIcon mIcon;
              public BackgroundPanel(ImageIcon icon) {
                   mIcon= icon;
                   super.setOpaque(false);
              public void setOpaque(boolean flag) { }
              public void paint(Graphics g)
                   g.drawImage(mIcon.getImage(), 0, 0, null);
                   super.paint(g);
         public static void main(String[] argv)
              JFrame frame= new JFrame(argv[0]);
              BackgroundPanel panel= new BackgroundPanel(new ImageIcon(argv[0]));
              panel.setLayout(new GridLayout(0,2,4,4));
              panel.setBorder(new EmptyBorder(4,4,4,4));
              panel.add(new JLabel("Name"));
              panel.add(new JTextField());
              panel.add(new JLabel("Address"));
              panel.add(new JTextField());
              panel.add(new JLabel("Phone"));
              panel.add(new JTextField());
              frame.getContentPane().add(panel, BorderLayout.CENTER);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.pack();
              frame.setResizable(false);
              frame.setVisible(true);
    }

  • Implementing java.sql within PersonalJava

    I'm writing a simple application to implement within the PersonalJava JVM. The application has to use a number of classes out of the java.sql package. When I try to run my application, I get NoClassDefFoundError messages for any code that references java.sql. This makes sense after reading a number of posts and references on Sun's site about java.sql being an optional package of the PersonalJava Application Environment. However, I have not found anywhere on Sun's site or any other site about where to download such a package. Has anyone come across this before and found a decent solution? Thanks in advance.

    Did you check your CLASSPATH variable when you compile. I believe that you need the file classes12.zip. When I installed oracle it came with the class files that I was looking for. I have installed 8.1.7 and in the oracle package, you get this zip files with a bunch of classes. If you are using another database, you might want to get their classes. The zip files has the java.sql that I was looking for.
    Hope this helps.

  • How to implement & run VBScript within SQL 2008?

    Hello what are the steps to implement/configure a VBScript (with .config file) with SQL 2008?
    (The VBScript file is a sync process that does DMLs within the SQL Server DB that it's on and also updates data on an exterior DB.)
    (Perhaps within a Stored Procedure-Job best way?)
    Thanks in advance.

    Although you could probably accomplish this with a SQLCLR proc, my opinion is an ETL process is better suited for SSIS.  I suggest a job that executes an SSIS package with a Script task.  You can use SSIS configurations to pass the configurable
    value to the script at run time via package variables. 
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Count distinct within a query

    Hi there,
    I have a below query that has a count field, which I want to have count of unique records.
    SELECT [SGMT_REV_BY_SITE].GLSeq, Count([SGMT_REV_BY_SITE].SITE_ADDR_ID) AS NUM_SITES, [SGMT_REV_BY_SITE].SGMNT1, [SGMT_REV_BY_SITE].SGMNT2, [SGMT_REV_BY_SITE].LOB$, [SGMT_REV_BY_SITE].PERIOD, [SGMT_REV_BY_SITE].RECUR, [SGMT_REV_BY_SITE].PROMOTED, Sum([SGMT_REV_BY_SITE].REV_GRS)
    AS REV_GRS_Sum, Sum([SGMT_REV_BY_SITE].REV_NET) AS REV_NET_Sum, IIf(NUM_SITES >0, REV_GRS_Sum/NUM_SITES, REV_GRS_Sum) AS ARPSg_Sum, IIf(NUM_SITES >0, 
    REV_NET_Sum/NUM_SITES, REV_NET_Sum) AS ARPSn_Sum
    FROM SGMT_REV_BY_SITE
    WHERE ([SGMT_REV_BY_SITE].SGMNT1="Small"
    Or [SGMT_REV_BY_SITE].SGMNT1="Medium")
    And [SGMT_REV_BY_SITE].PERIOD>#12/31/2013#
    And [SGMT_REV_BY_SITE].RECUR=Yes
    And [SGMT_REV_BY_SITE].PROMOTED=Yes
    And [SGMT_REV_BY_SITE].REV_NET<>0
    GROUP BY [SGMT_REV_BY_SITE].GLSeq, [SGMT_REV_BY_SITE].LOB$, [SGMT_REV_BY_SITE].SGMNT1, [SGMT_REV_BY_SITE].SGMNT2, [SGMT_REV_BY_SITE].PERIOD, [SGMT_REV_BY_SITE].RECUR, [SGMT_REV_BY_SITE].PROMOTED;
    Is there an easy way of accomplishing the task.
    Thanks in advance for help.

    ARSagit,
    Unfortunatly access don't support count(distinct fieldname) statement...
    Workaround is:
    SELECT [NS].glseq,
    Count([NS].site_addr_id) AS NUM_SITES,
    [NS].sgmnt1,
    [NS].sgmnt2,
    [NS].lob$,
    [NS].period,
    [NS].recur,
    [NS].promoted,
    FROM (
    SELECT DISTINCT
    [sgmt_rev_by_site].glseq,
    [sgmt_rev_by_site].site_addr_id
    [sgmt_rev_by_site].sgmnt1,
    [sgmt_rev_by_site].sgmnt2,
    [sgmt_rev_by_site].lob$,
    [sgmt_rev_by_site].period,
    [sgmt_rev_by_site].recur,
    [sgmt_rev_by_site].promoted,
    FROM
    sgmt_rev_by_site
    WHERE [sgmt_rev_by_site].sgmnt1 in ("small","medium")
    AND [sgmt_rev_by_site].period >#12/31/2013#
    AND [sgmt_rev_by_site].recur = yes
    AND [sgmt_rev_by_site].promoted = yes
    AND [sgmt_rev_by_site].rev_net <>0) AS NS
    GROUP BY [NS].glseq,
    [NS].lob$,
    [NS].sgmnt1,
    [NS].sgmnt2,
    [NS].period,
    [NS].recur,
    [NS].promoted;
    With this quer you can join with main query and show num_sites....
    Michał

  • Adjusting numbers within a sum column, but keep sum constant

    Hi, all-- I've looked and looked and can't quite find a way to do this.
    I have a budget of, say, $70,000 for payroll to split among three people. I have to keep the total budget at $70,000 but I can adjust the three pay rates. Is there a way to set up a table allows me to adjust a pay rate, but keep the total constant (i.e., automatically adjust the other two values)?
    I can't seem to phrase this properly in the search function here, so my apologies if this is already answred.
    Thanks very much,
    Chris

    To do it the same basic way as above, you can have sliders for two of them but the third has to be determined with a formula. 
    B2 and B3 are sliders with the limits 0 to 70000
    B4 = if(70000-B2-B3<0, "Pay the other guys less!!", 70000-B2-B3)
    You can use sliders on all three if they set the relative amount of pay each person gets.
    C2 through C4 are sliders with limits of 0 to whatever
    B2 =70000*C2/SUM(C$2:C$4)
    B3 =70000*C3/SUM(C$2:C$4)
    B4 =70000*C4/SUM(C$2:C$4)

  • Cummulative Sum in OBIEE 11g

    Hi,
    i have generated a report,need to create cummulative sum in my reports.can anyone give me the solution how to do.cummulative sum like
    col1 col2 col 3(cummulative_sum)
    A 5 5
    B 10 15(5+10)
    c 15 30(15+15)
    appreciate your response.
    Brgds,
    GN
    Edited by: GN on 31 Jan, 2012 3:48 AM

    Hi,
    You can use RSUM(Measure_Column).
    Regards
    MuRam
    NOTE- Please make this thread closed/or still facing issue so that it could help others.

  • Rolling sum in OBIEE 11 g

    Hi All,
    I have data in my report like this.
    Month Sales rsum
    01 100 100
    02 200 300
    03 400 700
    05 500 500
    Month 04 doesnt have sales so it is not showing in the report that why the rsum is now 500 as it starts the new row with 05 only.
    The data should be like this.
    Month Sales rsum
    01 100 100
    02 200 300
    03 400 700
    05 500 1200
    any workaround for this.

    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

  • MeasureExpression property - Is there a possibility to implement distinct count with exclude empty?

    I have a measure which needs to have distinct count aggregation with exclude empty.
    Is there a possibility to specify MeasureExpression property to achieve the same? I have set the aggregation of the measure to none and I have typed the following function,
    Count(Distinct(Column_name),EXCLUDEEMPTY)
    where as the measure reads 0(zero) upon processing. Is there any other way to achieve this?
    The data feed has nulls included too for the column which this is to be achieved, which cannot be modified in the data level.
    Regards,
    Kantha Girish

    Hi Kantha,
    According to your description, you want to implement the distinct count aggregation, right? In this case, we can use a query like
    count(nonempty([DimName].[HierarchyName].[LevelName].members,[Measures].[MyMeasure]))
    Here are some blogs about how to implemet distinct count aggregation, please refer to the link below.
    http://blog.sqltechie.com/2009/09/distinctcount-analysis-service.html
    http://richardlees.blogspot.com/2008/10/alternative-to-physical-distinct-count.html
    If I have anything misunderstood, please point it out.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Summing on a distinct picking the max-ones

    Hello All,
    I have to write a difficult query (well, difficult for me) which should give me a -month summary- from a value (DUR) which is related to another (FK_ID) which sometimes repeat and in case of repetitions I need to sum on the highest DUR.
    I have the query without picking up only the highest (therefore summing everything) and it looks like following (I took out some more data queried to gain visibility):
    SELECT distinct MONTH
    , sum(case when ABC = 'SM' and DEF = 'PD' then DUR end) as smpd_dur
    FROM YTDDATA where year = 2009
    group by MONTHThanks!
    terrn

    You mean you want this output?
    SQL> ed
    Wrote file afiedt.buf
      1  with YTDDATA as (select 2009 YEAR, 1 MONTH, 1 FK_ID, 'SM' ABC,  'PD' DEF, 1 DUR from dual union all
      2                  select 2009 YEAR, 1 MONTH, 2 FK_ID, 'SD' ABC,  'PD' DEF, 2 DUR from dual union all
      3                  select 2009 YEAR, 1 MONTH, 3 FK_ID, 'SM' ABC,  'PD' DEF, 3 DUR from dual union all
      4                  select 2009 YEAR, 2 MONTH, 4 FK_ID, 'SD' ABC,  'PD' DEF, 4 DUR from dual union all
      5                  select 2009 YEAR, 2 MONTH, 5 FK_ID, 'SD' ABC,  'PD' DEF, 10 DUR from dual union all
      6                  select 2009 YEAR, 2 MONTH, 6 FK_ID, 'SM' ABC,  'PD' DEF, 12 DUR from dual union all
      7                  select 2009 YEAR, 2 MONTH, 6 FK_ID, 'SM' ABC,  'PD' DEF, 1 DUR from dual union all
      8                  select 2009 YEAR, 3 MONTH, 8 FK_ID, 'SD' ABC,  'PD' DEF, 34 DUR from dual union all
      9                  select 2009 YEAR, 3 MONTH, 9 FK_ID, 'SA' ABC,  'PD' DEF, 2 DUR from dual union all
    10                  select 2009 YEAR, 3 MONTH, 10 FK_ID, 'SM' ABC,  'PD' DEF, 33 DUR from dual union all
    11                  select 2009 YEAR, 4 MONTH, 11 FK_ID, 'SM' ABC,  'PD' DEF, 43 DUR from dual union all
    12                  select 2009 YEAR, 5 MONTH, 12 FK_ID, 'SM' ABC,  'PD' DEF, 24 DUR from dual union all
    13                  select 2009 YEAR, 5 MONTH, 13 FK_ID, 'SD' ABC,  'PD' DEF, 3 DUR from dual union all
    14                  select 2009 YEAR, 5 MONTH, 14 FK_ID, 'SM' ABC,  'PD' DEF, 31 DUR from dual union all
    15                  select 2009 YEAR, 6 MONTH, 15 FK_ID, 'SD' ABC,  'PD' DEF, 14 DUR from dual union all
    16                  select 2009 YEAR, 6 MONTH, 16 FK_ID, 'SM' ABC,  'PD' DEF, 13 DUR from dual)
    17  SELECT distinct MONTH
    18       , sum(case when ABC = 'SM' and DEF = 'PD' then max_dur end) as smpd_dur
    19  FROM (SELECT MONTH
    20        ,case when count(*) over (partition by month, fk_id) > 1 then
    21              case when max(dur) over (partition by month, fk_id) = dur then dur else null end
    22         else dur
    23         end as max_dur
    24        ,ABC, DEF
    25       FROM YTDDATA where year = 2009)
    26  group by MONTH
    27* order by month
    SQL> /
         MONTH   SMPD_DUR
             1          4
             2         12
             3         33
             4         43
             5         55
             6         13
    6 rows selected.
    SQL>I'm sure there's an analytical dense rank keep type thing that will do that too.

  • Summing up a Column in ALV report

    Hi All,
    I have developed an ALV Report which will display Invoices and other details.
    Now i need to display the sum of NETWR column, if user wish to select that column and click the "SUM" icon.
    As of now, if i select the NETWR column and click 'SUM" column, i am getting Runtime error.
    How to resolve this issue?
    Regards
    Pavan

    Hi Pavan,
    ALV GRID CONTROL:
    This task is performed by the SAP Control Framework.
    The R/3 System allows you to create custom controls using ABAP Objects. The application server is the Automation Client, which drives the custom controls (automation server) at the front end.
    If custom controls are to be included on the frontend, then the SAPGUI acts as a container for them.
    Custom controls can be ActiveX Controls or JavaBeans.
    The system has to use a Remote Function Call (RFC) to transfer methods for creating and using a control to the front end.
    ABAP objects are used to implement the controls in programs.
    An SAP Container can contain other controls (for example, SAP ALV Grid Control, Tree Control, SAP Picture Control, SAP Splitter Control, and so on). It administers these controls logically in one collection and provides a physical area for the display.
    Every control exists in a container. Since containers are themselves controls, they can be nested within one another. The container becomes the parent of its control. SAP containers are divided into five groups:
    SAP custom container: Displays within an area defined in Screen Painter on screens or sub screens.
    Class: CL_GUI_CUSTOM_CONTAINER
    SAP dialog box container: Displays in a modeless dialog box or as a full screen. Class:
    CL_GUI_DIALOGBOX_CONTAINER
    SAP docking container: Displays as docked, resizable sub-window with the option of displaying it as a modeless dialog box. Class: CL_GUI_DOCKING_CONTAINER
    SAP splitter container: Displays and groups several controls in one area - that is, splits the area into cells Class: CL_GUI_SPLITTER_CONTAINER
    SAP easy splitter container: Displays controls in two cells, which the user can resize using a split bar. Class: CL_GUI_EASY_SPLITTER_CONTAINER.
    In the control, you can adjust the column width by dragging, or use the 'Optimum width' function to adjust the column width to the data currently displayed. You can also change the column sequence by selecting a column and dragging it to a new position.
    Standard functions are available in the control toolbar. The details display displays the fields in the line on which the cursor is positioned in a modal dialog box.
    The sort function in the ALV Control is available for as many columns as required. You can set complex sort criteria and sort columns in either ascending or descending order.
    You can use the 'Search' function to search for a string (generic search without *) within a selected area by line or column.
    You can use the 'Sum' function to create totals for one or more numeric columns. You can then use the "Subtotals" function to set up control level lists: You can use the 'Subtotal' function to structure control level lists: select the columns (non-numeric columns only) that you want to use and the corresponding control level totals are displayed.
    For 'Print' and 'Download' the whole list is always processed, not just the sections displayed on the screen.
    You can define display variants to meet your own specific requirements. For information on saving variants, see 'Advanced Techniques'.
    The ALV grid control is a generic tool for displaying lists in screens. The control offers standard functions such as sorting by any column, adding numeric columns, and fixed lead columns .
    Data collection is performed in the program (with SELECT statements, for example) or by using a logical database. The data records are saved in an internal table and passed on to the ALV control along with a field description.
    The field description contains information about the characteristics of each column, such as the column header and output length. This information can defined either globally in the Dictionary (structure in the Dictionary) or in the field catalog in the program itself. You can also merge both techniques.
    The ALV link is a standard function of Query and QuickViewer. If multiline queries or Quick View lists have been defined, they will automatically be compressed to a single line and output in the ALV control as a long, single line list.
    Use Screen Painter to create a sub screen container for the ALV grid control. The control requires an area where it can be displayed in the screen. You have to create a container control that determines this area.
    Use the corresponding icon in the Screen Painter layout to create the container control. The size of area "MY_CONTROL_AREA" determines the subsequent size of the ALV control.
    The valid GUI status must be set at the PBO event in the flow logic of the ALV subscreen container.
    The OK_CODE processing for the cancel functions must be programmed at the PAI event.
    The reference variables for the custom container and the ALV grid control must be declared.
    To create reference variables, use ABAP statement TYPE REF TO .
    The global classes you need to do this are called cl_gui_custom_container (for the custom container control) and cl_gui_alv_grid (for the ALV grid control).
    The global classes are defined in the Class Builder. You can use the Class Builder to display information for the methods, their parameters, exceptions, and so on.
    Use ABAP statement CREATE OBJECT to create the objects for the container and the ALV control. Objects Are instances of a class.
    When an object is created (CREATE), method CONSTRUCTOR of the corresponding class is executed. The parameters of method CONSTRUCTOR determine which parameters have to be supplied with data when the object is created. In the above example, object alv_grid is given the name of the container control (g_custom_container) in exporting parameter i_parent, which links the two controls. For information on which parameters method CONSTRUCTOR possesses and which of these parameters are required, see the Class Builder.
    Objects should only be created once during the program. To ensure that this is the case, enclose the CREATE OBJECT statement(s) in an IF IS INITIAL. ... ENDIF clause. The objects must be generated before the control is displayed for the first time - that is, during the PBO event of the ALV subscreen container.
    To display the requested dataset in the ALV control, the data must be passed on to the control as an internal table, and a field description must exist indicating the order in which the columns will be output.
    In the simplest case, the field description can use a structure from the Dictionary. The Dictionary also determines the technical field attributes like type and length, as well as the semantic attributes like short and long texts. The ALV control uses this information to determine the column widths and headers. The column sequence is determined by the field sequence in the structure.
    If no suitable structure is active in the Dictionary, or you want to output internal program fields in the control, then you will have to define information like the output length and column header in the field catalog.
    In a typical program run, the dataset is read first (SELECT ....), the internal table is filled with the data to display (... INTO TABLE ...), and ABAP statement CALL SCREEN is then used to call the ALV sub screen container.
    The data transfer to the ALV control takes place during the call of method
    set_table_for_first_display from class cl_gui_alv_grid. The method call must be programmed at the PBO event of the ALV subscreen container.
    The name of the Dictionary structure that supplies the field description is specified in exporting parameter i_structure_name. The name of the internal table that contains the data records to display is specified in changing parameter it_outtab.
    The field description for the ALV control can be ta ken from an active Dictionary structure (fully automatic), by passing a field catalog (manual), or through a mixture of the two options (merge).
    The field catalog is in internal table with type lvc_t_fcat. This type is defined globally in the Dictionary.
    Each line in the field catalog table corresponds to a column in the ALV control.
    The field characteristics (= column characteristics) are defined in the field catalog. The field catalog is in internal table with type lvc_t_fcat. Each line that is explicitly described in the ALV control corresponds to a column in the field catalog table.
    The link to the data records to output that are saved in internal table is established through field name . This name must be specified in column "fieldname" in the field catalog.
    This field can be classified through a Dictionary reference (ref_table and ref_field) or by specifying an ABAP data type (inttype).
    Column headers and field names in the detail view of an ALV control line can be determined in the field catalog in coltext and seltext, respectively.
    The position of a field during output can be determined with col_pos in the field catalog.
    If you want to hide a column, fill field no_out with an "X" in the field catalog. Hidden fields can be displayed again in a user display variant.
    Icons can be displayed in the ALV control. If you want a column to be interpreted as an icon, then the icon name must be known to the program (include .) and icon = "X" must be specified for this column in the field catalog.
    The above example shows a semi-automatic field description: Part of the field description comes from the Dictionary structure (sflight), while another part is explicitly defined in the field catalog (gt_fieldcat).
    The field catalog (internal table) is filled in the program and is passed on together with the name of the Dictionary structure during the method call. The information is merged accordingly in method set_table_for_first_display.
    For a user to save display variants, parameters is_variant and i_save must be passed on during method call set_table_for_first_screen. To assign display variants uniquely to a program, at least the program name must be supplied in the transferred structure (gs_variant).
    Program names can be up to 30 characters long.
    If you only pass on the current parameters for is_variant, then existing variants can be loaded, but no new ones can be saved. If you use parameter i_save, you must pass on a variant structure with is_variant.
    I_SAVE = SPACE No variants can be saved.
    I_SAVE = 'U' The user can only save user-specific variants.
    I_SAVE = 'X' The user can only save general (shared) variants.
    I_SAVE = 'A' The user can save both user-specific and general (shared) variants.
    You can use parameter is_layout of method set_table_for_first_display, for example, to define the header in the ALV control and the detail display.
    To do this, define a query area in the program in accordance with Dictionary structure lvc_s_layo, and pass on the text to display in field -grid_title or -detailtitl.
    If you want to create print lists with zebra stripes, set field -zebra to "X". You can display a print preview for print lists by requesting standard function "Print".
    All parameters of method SET_TABLE_FOR_FIRST_DISPLAY from global class
    CL_GUI_ALV_GRID are defined in the Class Builder.
    Events are defined in global class cl_gui_alv_grid; you can use these events to implement user interaction within the program. To respond to a double -click on a table line, you must respond to event DOUBLE_CLICK.
    You receive control in the program, allowing you to implement interactive reporting - such as a full screen details list. The events for cl_gui_alv_grid are located in the Class Builder.
    To define an implement a local class in the program, you use a handler method. In this handler method, you program the functionality to trigger by a double -click in the output table.
    To activate a handler method at runtime, a class or an object from that class registers itself with an event using command SET HANDLER. The names of the IMPORTING parameters in the handler method correspond to the names of the EXPORTING parameters of the related event.
    In the above example, the local class is LCL_ILS and the handler method is ON_DBLCLICK. An object - ALV_DBLCLICK - is created and registers itself for event DOUBLE_CLICK.
    You can query parameter e_row-index to determine which output line was requested by the double -click. This parameter corresponds to the line number of the output table (internal table with the data records to output). If you need information for the selected line, you have to read it with READ TABLE itab INDEX e_row-index.
    This subsequent read in the output table generally corresponds to the HIDE area in conventional reporting. You first have to make sure that the user has double -clicked a line in the output table (similar to the valid line selection with the HIDE technique).
    A field group can contain global data objects, but not data objects that have been defined locally in a subroutine or function module.
    You can use INSERT to specify both fields and field symbols. This makes it possible to dynamically insert a data object referred to by a field symbol into a field group at runtime. Any field symbols that have not been assigned are ignored, which means no new field is inserted into the field group.
    The EXTRACT statement writes all the fields of a field group as one record to a sequential dataset (transport takes place with similarly named fields). If a HEADER field group is defined, then its fields are placed ahead of each record as sort keys. You can then sort the dataset with SORT and process it with LOOP ...ENDLOOP. In this case, no further EXTRACT is possible.
    The INSERT statement is not a declarative statement: This means field groups can also be expanded in the program flow section.
    As soon as the first dataset of a field group has been extracted with EXTRACT, that field group can no longer be expanded with INSERT. In particular, the HEADER field group cannot be expanded after the first EXTRACT (regardless of the field group).
    When the GET events are processed, the logical database automatically writes hexadecimal zeros in all the fields of a node when it returns to an upper-level node in the hierarchy. Since the HEADER normally contains sort fields for all field groups, these hexadecimal zeros in the HEADER serve as a type of hierarchy key: The more zeros there are, the further up in the control level hierarchy you go.
    &#61550;&#61472;The SORT statement sorts the extract dataset in accordance with the defined field sequence in field group HEADER. The addition BY ... sets a new sort key.
    Each must be either a field of field group HEADER or a field group that consists only of fields of the field group HEADER. You can use the additions ASCENDING and DESCENDING to determine whether the fields are sorted in ascending (default) or descending order.
    Fields containing X'00' in the logical databases are always displayed before all other values during a SORT.
    Processing of an extract dataset always takes places within a LOOP. The contents of the extract dataset field are placed in program fields with the same names.
    The group change always involves the fields of the HEADER. Single record processing for extract datasets is performed using language element AT ( = field group).
    CNT() is not a statement, but instead a field that is automatically create d and filled when is a non-numeric field from field group HEADER and is part of the sort key. At the end of the group, CNT() contains the number of different values that the field recorded in this group level.
    SUM() is not a statement, but instead a field that is automatically created and filled when is a numeric field of an extract dataset. At the end of the group, SUM() contains the control total of field .
    *** and CNT are only available at the end of the group level or at AT LAST.
    Single record processing for extract datasets AT WITH is only performed when field group is immediately followed by field group in the temporary dataset.
    Loops over an extract dataset cannot be nested. However, several contiguous loops are permitted.
    The sequence of the control level changes within the LOOP must correspond to the sort sequence.
    Totals can only be calculated within control footer processing.
    Extracts allow only appends (EXTRACT), sorting (SORT) and sequential processing (LOOP).
    Once a SORT or LOOP has occurred, the intermediate dataset is frozen and cannot be expanded with EXTRACT. Operations that insert into or delete from EXTRACT datasets are not supported.
    Extracts allow for several record types (FIELD-GROUPS) with fields that can be set dynamically (INSERT is not a declarative statement!). Internal tables have a single, statically-defined line type.
    Internal tables use the sequence of table fields according to the declaration for the hierarchy of the control leve l. The control level structure for internal tables is therefore static, and is independent of which criteria were used to sort the internal table.
    Extracts do not depend on the field sequence for control level processing: a re-sort or a completely different control level process can take place. The control level structure for extract datasets is therefore dynamic. It corresponds exactly to the sort key of the extract dataset. The sort key is the sequence of fields from the field group HEADER, and is used to sort the extract dataset.
    Extracts rely on the compiler to determine which combinations of group levels and a cumulating field the control level totals desire. The desired control level totals are determined by the processing of LOOP ... ENDLOOP blocks. Internal tables build the control level total with the SUM statement.
    This procedure leads to high resource depletion for totaling control levels in internal tables.
    Regards,
    Chandru

  • OBIEE-EBS data security integration

    Hi all,
    I am trying to implement the HR-Org based data security in EBS-OBIEE integration.
    After creating the initialization blocks EBS Single Sign-on Integration,Get Oracle EBS Security Context,Group-EBS Responsibility I have created a new initialization block HR Organizations to populate the session variable "HR_ORG" and I am using the following the query.
    Even though the session variables GROUP and USER are getting their values correctly and integration works fine, the variable HR_ORG says "has no value definition".
    [nQSError: 10058] A general error has occurred. [nQSError: 23006] The session variable, NQ_SESSION.HR_ORG, has no value definition. (HY000)
    SQL Issued: SELECT "Per Business Groups"."Business Group Id", VALUEOF(NQ_SESSION.HR_ORG) FROM HR
    Please help me for implementing the data security after the EBS-OBIEE integration..
    For populating HR_ORG variable by row wise initialization:
    SELECT DISTINCT 'HR_ORG',TO_CHAR(SEC_DET.ORGANIZATION_ID)
    FROM
    SELECT
    'HR_ORG', ASG.ORGANIZATION_ID
    FROM
    FND_USER_RESP_GROUPS URP
    ,FND_USER USR
    ,PER_SECURITY_PROFILES PSEC
    ,PER_PERSON_LIST PER
    ,PER_ALL_ASSIGNMENTS_F ASG
    WHERE
    URP.START_DATE < TRUNC(SYSDATE)
    AND (CASE WHEN URP.END_DATE IS NULL THEN TRUNC(SYSDATE) ELSE TO_DATE(URP.END_DATE) END) >= TRUNC(SYSDATE)
    AND USR.USER_NAME = ':USER'
    AND USR.USER_ID = URP.USER_ID
    AND TRUNC(SYSDATE)
    BETWEEN URP.START_DATE AND NVL(URP.END_DATE, HR_GENERAL.END_OF_TIME)
    AND PSEC.SECURITY_PROFILE_ID = FND_PROFILE.VALUE_SPECIFIC('PER_SECURITY_PROFILE_ID', URP.USER_ID, URP.RESPONSIBILITY_ID, URP.RESPONSIBILITY_APPLICATION_ID)
    AND PER.SECURITY_PROFILE_ID = PSEC.SECURITY_PROFILE_ID
    AND PER.PERSON_ID = ASG.PERSON_ID
    AND TRUNC(SYSDATE) BETWEEN ASG.EFFECTIVE_START_DATE AND ASG.EFFECTIVE_END_DATE
    AND URP.RESPONSIBILITY_ID = DECODE(FND_GLOBAL.RESP_ID,
    -1, URP.RESPONSIBILITY_ID,
    NULL, URP.RESPONSIBILITY_ID,
    FND_GLOBAL.RESP_ID)
    UNION
    SELECT DISTINCT 'HR_ORG',
    ORGANIZATION_ID
    FROM PER_ALL_ASSIGNMENTS_F ASG,
    FND_USER USR
    WHERE ASG.PERSON_ID = USR.EMPLOYEE_ID
    AND USR.USER_NAME = ':USER'
    AND TRUNC(SYSDATE) BETWEEN ASG.EFFECTIVE_START_DATE AND ASG.EFFECTIVE_END_DATE
    AND ASG.PRIMARY_FLAG = 'Y'
    ) SEC_DET
    Thx!

    Duplicate post see Re: obiee-ebs  data  security integration

  • Distinct Count doesn't return the expected results

    Hi All,
    I was fighting a little trying to implement a Distinct Count measure over an account dimension in my cube. I read a couple of posts relateed to that and I followed the steps posted by the experts.
    I could process the cube but the results I'm getting are not correct. The cube is returning a higher value compared to the correct one calculated directly from the fact table.
    Here are the details:
    Query of my fact table:
    select distinct cxd_account_id,
              contactable_email_flag,
              case when recency_date>current_date-365 then '0-12' else '13-24' end RECENCY_DATE_ROLLUP,
              1 QTY_ACCNT
    from cx_bi_reporting.cxd_contacts
    where cxd_account_id<>-1 and recency_date >current_date-730;
    I have the following dimensions:
         Account (with 3 different hierarchies)
         Contactable Email Flag (Just 3 values, Y, N, Unknown)
         Recency_date (Just dimension members)
    All dimensions are sparse and the cube is a compressed one. I defined "MAXIMUM" as aggregate for Contactable Email flag and Recency date and at the end, SUM over Account.
    I saw that there is a patch to fix an issue when different aggregation rules are implemented in a compressed cube and I asked the DBA folks to apply it. They told me that the patch cannot be applied because we have an advanced version already installed (Patch 11.2.0.1 ).
    These are the details of what we have installed:
          OLAP Analytic Workspace       11.2.0.3.0 VALID
          Oracle OLAP API 11.2.0.3.0 VALID
          OLAP Catalog 11.2.0.3.0 VALID
    Is there any other patch that needs to be applied to fix this issue? Or it's already included in the version we have installed (11.2.0.3.0)?
    Is there something wrong in the definition of my fact table and that's why I'm not getting the right results?
    Any help will be really appreciated!
    Thanks in advance,
    Martín

    Not sure I would have designed the dimensions /cubes as you,  but there is another method you can obtain distinct counts.
    Basically relies on using basic OLAP DML Expression language and can be put in a Calculated Measure, or can create two Calculated measures
    to contain each specific result.  I use this method to calculate distinct counts when I want to calculate averages, etc ...
    IF account_id ne -1 and (recency_date GT today-365) THEN -
    CONVERT(NUMLINES(UNIQUELINES(CHARLIST(Recency_date))) INTEGER)-
    ELSE IF account_id ne -1 and (recency_date GT today-730 and recency_date LE today-365) THEN -  
    CONVERT(NUMLINES(UNIQUELINES(CHARLIST(Recency_date))) INTEGER)-
    ELSE NA
    This exact code may not work in your case, but think you can get the gist of the process involved.
    This assumes the aggregation operators are set to the default (Sum), but may work with how you have them set.
    Regards,
    Michael Cooper

  • Dynamic Column Selector in OBIEE - Solution required

    Hello Experts,
    I am pretty new to OBIEE. Please help me to get OBIEE solution for below requirement.
    I have one 25 column dimension table in database. Created OBIEE .rpd file and published in BI server. Now I need to provide one user interface in which user should be able to chose any number of columns of his choice and he should get record set of those selected columns. Something in my mind is like this.
    I should be providing list of 25 column names with check box to select one or many. Assuming that if user selects Col1, Col3,Col5 and Col7 then he should get the result in excel file with record set of those 4 columns.
    I am using OBIEE 10g.
    Any solution for this is highly appreciated.
    Edited by: user7850154 on Dec 5, 2010 9:22 AM

    user,
    Usually, dynamic column seletor is implemented through "column selector view" available within compund layout of OBIEE Answers.
    But, it does allow you to select only single column rather than multiple columns - which in your case is required.
    J
    -bifacts
    http://www.obinotes.com

  • Sum Based on The Value of Another Group

    I'm using RS 2005 and trying to accomplish the following:
    Here is the detail data for those customers with negative balance. For example cust2 = -50 and cust3 = -30
    Cust ID    Ord #   Balance
    cust1        1          30
    cust1        2          80
    cust2        1        100
    cust2        2       -150
    cust3        1        100
    cust3        2         70
    cust3        3       -200
    cust4        1       100
    cust4        2         50
    cust5        1       250
    cust5        2         20
    Total (net) balance for cust1 is 110
    Total (net) balance for cust2 is -50 (100 + -150)
    Total (net) balance for cust3 is -30 (100 + 70 + -200)
    Total (net) balance for cust4 is 150
    Total (net) balance for cust5 is 270
    i have to aggregate the customer balance in group A (group by Cust ID)
    For group B, Division - I only want sum the  balance of the customers within that division that have a negative balance (the balance aggregate in group A).
    so the Total for Division (group B) is  -80 (bal of cust2 + bal of cust3)
    in summary, i have to aggregate the balance for each customer, base on the balance of each customer (neg bal only), i aggregate the balance for the Division.  Your help/suggestion is greatly appreciated.

    Hi Bryan,
    First, did you trying to do this at query level or at RS using grouping and expression?
    With query, to get aggregate for each customer, simply do:
    select distinct Cust_ID, TotalBalance = sum(Balance)
    from <your table>
    group by Cust_ID
    To get the aggregate for division, try:
    select Total = sum(case when TotalBalance > 0 then 0 else TotalBalance end)
    from (
    select distinct Cust_ID, TotalBalance = sum(Balance)
    from <your table>
    group by Cust_ID
    ) t1
    ** Didn't see this has been replied.

Maybe you are looking for

  • SRM TO R3 Integration

    Hi experts, I have a doubt concerning SRM integration in backend system (R/3). Is it possible to change PO data (for example cost center) while integrating with r/3 (for example with a badi). Looking forward to hear from you, Best Regards, Mário.

  • System clean up?

    Having made the swap from Windows to OS-X some 18 months ago I must report a very happy new playground has been found. However as its been awhile I'm sure the system could do with a tidy; I'm unclear on the best approach to this in Mac world? I'm sti

  • MDM Questions

    Dear MDM Specialists, we have a requirement wherein we need to create a unique 14 digit alpha numric number for every new record we create.This number needs to be the next sequence number with every new record creation. The character part of the alph

  • Calling a procedure that returns a cursor inside a procedure

    Hi, I have two stored procedures. They both return a cursor as output variables. On the other hand I have another stored procedure that calls these procedures and return their results again an output variable. I know that this seems quite odd to be w

  • "Preview this File" Does Nothing + Blinding GTK+ open file dialogs...

    ...I have two problems in KDEMod4...did anyone have these problems and how do you fix them? Right clicking a file and clicking "Preview this File" does nothing...including folder views, Konqueror, and Dolphin. GTK+ open file dialogs alternate between