Issues with query using joins in 3 tables

I am trying to fetch data from 3 tables (Project,RIsk and Issues) using join. There are Risks associated with some projects and Issues associated with some projects.
ProjectID is primary key in Project table.
RiskID is primary key in risk table. ProjectID is foreign key.
IssueID is primary key in Issue table.ProjectID is foreign Key.
I need the projectname, count of risks for projects, count of issues for projects. I am using joins in all the 3 tables. Issue here is, its giving me double of count of risks and issues for each project.
Please advise how can I get the correct number. I have used the below query,
select p.projectname,count(r.riskid),count(i.issueid) from project as p
left outer join risk as r on p.projectid=r.projecctid
left outer join issue as i on p.projectid=i.projectid
group by
p.projectname
thanks

Hi All,
I got a new requirement to count, the number of high priority risks as well as high priority issues along with the other details. I modified the below table to include the changes, but I am not getting the desired result. Could you please help?
Original query:
select p.projectname,count(distinct r.riskid), count(distinct i.issueid) from project as p
left outer join risk as r on p.projectid=r.projecctid
left outer join issue as i on p.projectid=i.projectid
group by p.projectname
Modified query:
select p.projectname,count(distinct r.riskid),sum(case when r.riskpriority='high' then 1 else 0 end), sum(case when i.issuepriority='high' then 1 else 0 end),count(distinct i.issueid) from project as p
left outer join risk as r on p.projectid=r.projecctid
left outer join issue as i on p.projectid=i.projectid
group by p.projectnameI should get the desired result as:XYZ,8,1,4,4But I am getting:XYZ,8,4,4,32thanks for the reply.

Similar Messages

  • Issue with query using minus operation

    Hello All,
    I have data set of all organization numbers like as below
    Dataset:
    ('528801','528802','536101','536102','100601','536401','536402','530701','536501','536502','540501','599101','133301',
    '531101','143101','536601','536602','534401','535501','535401','536801','536802','531001','537501','537502','540601','540801','528401')
    And i also have a table W_INT_ORG_D where in it has column like ORG_NUM which holds the organization numbers in the database, now i am trying to find out the exclusive organization numbers in the data set that does not exist in W_INT_ORG_D using some oracle sql query.
    Below is the sql i wrote though my query is wrong probably you could able to understand what i am trying to say or achieve, i am not ok with creating another table and filling in the data and later compare both tables, i want to do that without creating any extra table. Please let me know if you have any idea to do this, appreciate your time.
    Query:_
    WITH ABC AS
    ('528801','528802','536101','536102','100601','536401','536402','530701','536501','536502','540501','599101','133301',
    '531101','143101','536601','536602','534401','535501','535401','536801','536802','531001','537501','537502','540601','540801','528401')
    SELECT DISTINCT ORG_NUM
    FROM W_INT_ORG_D, ABC
    WHERE DATASOURCE_NUM_ID='211'
    AND ORG_NUM IN
    ('528801','528802','536101','536102','100601','536401','536402','530701','536501','536502','540501','599101','133301',
    '531101','143101','536601','536602','534401','535501','535401','536801','536802','531001','537501','537502','540601','540801','528401')
    MINUS
    SELECT * FROM ABC
    Thanks,
    Sam

    This wil give a list of organization numbers in dataset that are not present in the view:
    SELECT column_value org_num
       FROM TABLE(sys.odciVarchar2List(
                                       '528801',
                                       '528802',
                                       '536101',
                                       '536102',
                                       '100601',
                                       '536401',
                                       '536402',
                                       '530701',
                                       '536501',
                                       '536502',
                                       '540501',
                                       '599101',
                                       '133301',
                                       '531101',
                                       '143101',
                                       '536601',
                                       '536602',
                                       '534401',
                                       '535501',
                                       '535401',
                                       '536801',
                                       '536802',
                                       '531001',
                                       '537501',
                                       '537502',
                                       '540601',
                                       '540801',
                                       '528401'
    MINUS
    SELECT  DISTINCT ORG_NUM
       FROM  W_INT_ORG_D
       WHERE DATASOURCE_NUM_ID='211'
    /SY.
    Edited by: Solomon Yakobson on Jun 29, 2009 10:49 AM

  • SELECT STATMENT USING JOINS OF 2 TABLE WITH UPT 200 ROWS

    Hi
         Any give me sample code for select statment'' SELECT STATMENT USING JOINS OF 2 TABLE WITH UPT 200 ROWS''.
    Thanks in advance .
    regards
    veera

    tables : mara.
    data : begin of itab occurs 0,
           matnr like mara-matnr,
           maktx like makt-maktx,
           end of itab.
    start-of-selection.
    select amatnr bmaktx into table itab up to 200 rows
            from mara as a inner join makt as b on bmatnr = amatnr.

  • Select Query using Joins

    Hi,
    Please give me the Select query
    I have to fetch   EBELN,BUKRS,LIFNR,BSART,EKORG,EKGRP,WAERS,WKURS  from EKKO and
                          EBELP,LGORT,MATKL ,WERKS,BEDNR,IDNLF,BPRME,NETPR   from EKPO and
                         MENGE, SAKTO,AUFNR,ANLN1,GSBER,PS_PSP_PNR                from EKKN and
                         LPEIN,EINDT,SLFDT,                                                                    from EKET.
    I have to fetch all the data into an single internal table(Mandatory) by a select query using Joins.
    EKKO is having EBELN as primary key
    EKPO is having EBELN,EBELP as primary key
    EKKN is having EBELN,EBELP as primary key
    EKET is having EBELN,EBELP as primary key
    Can anybody Please give me the Select query.
    With Regards
    Ajay

    Hi ,
    I am sending this sample coed for the Inner joins .Hope this will help you:
    Inner joins using 3 tables 
    Try this :-
    SELECT stpostlnr stpoidnrk mastmatnr maramtart stpo~menge 
    INTO CORRESPONDING FIELDS OF TABLE zmat1 FROM mast 
    JOIN stpo ON stpostlnr = maststlnr 
    JOIN mara ON maramatnr = mastmatnr 
    WHERE stpostlty = 'M' "AND stpoidnrk IN s_matnr 
    AND mast~werks = 1000. 
    Here s_matnr is a select-options on the selection-screen. 
    Or this. 
    Code: 
         Select single VbrkBukrs VbrkKunrg    Vbrk~Vbeln 
                       VbrkFkdat VbrkBstnk_Vf Vbrk~Zterm 
                       Tvzbt~Vtext 
                       VbakVbeln VbakBstdk 
                       LikpVbeln Likplfdat    Likp~Lfuhr 
           into w_vbrk 
           from vbrk 
          inner join       Tvzbt on TvzbtZterm        = VbrkZterm      and 
                                    Tvzbt~Spras        = sy-langu 
          Inner join       Vbfa  as SalesLnk 
                                 on SalesLnk~vbeln     = pu_vbeln        and 
                                    SalesLnk~vbtyp_v   = c_order 
                inner join Vbak  on VbakVbeln           = SalesLnkVbelv
          Inner join       Vbfa  as DeliveryLnk 
                                 on DeliveryLnk~vbeln   = pu_vbeln       and 
                                    DeliveryLnk~vbtyp_v = c_Delivery 
                inner join Likp  on LikpVbeln          = DeliveryLnkVbelv 
          where vbrk~vbeln = pu_Vbeln. 
    This code locates sales, delivery and payment terms info from a billing document number. 
    or
    Here, this one also works fine :
    select zfpcdcadivi zfpcdproforma zfpcdfactura zfpcdaniofactura 
    zfpcdmontousd zfpcdmontoap zfpcdebeln zfpcdinco1 
    zfpcdlifnr lfa1name1 zcdvsstatus zfpcdconint 
    into it_lista 
    from zfpcd inner join zcdvs 
    on zfpcdebeln = zcdvsebeln 
    and zfpcdproforma = zcdvsproforma 
    and zfpcdlifnr = zcdvslifnr 
    inner join lfa1 
    on zfpcdlifnr = lfa1lifnr 
    where zcdvs~status = '04'. 
    Also Here is another solution that just uses inner joins:
    SELECT vbakvbeln vbfaerdat INTO (itab-vbeln, itab-wadat)
    FROM ( vbak INNER JOIN vbap
    ON vbapvbeln = vbakvbeln )
    INNER JOIN vbfa ON vbakvbeln = vbfavbelv
    WHERE vbak~kunnr = m_wm AND
    vbak~vbtyp = 'C' AND
    vbfa~erdat IN s_date AND
    vbap~matnr = 'MZ1807F' AND
    vbfaposnv = vbapposnr AND
    vbfa~vbtyp_n = 'J'.
    <REMOVED BY MODERATOR>
    Cheers,
    Chandra Sekhar.
    Edited by: Alvaro Tejada Galindo on Apr 10, 2008 5:20 PM

  • How do I...Mimic Replacement Path with Query using Customer Variable Exits?

    Hello SDN:
    We are on BW 3.5 SP16.
    We are currently using a replacement path Query(RP) with variables
    to populate a variable in another Query(T).
    The problem we are having is with performance.
    The entry of variables in replacement path Query(RP) is optional (This is necessary there cannot be required values)
    When results from Replacement Path Query are small performance is fine. (e.g. 10 seconds)
    When results from Replacement path query are large performance suffers. (e.g. 1+ minutes)
    Users are free to leave the replacement path variables empty resulting in a large set of data to be replaced. This is the worst performance case.
    We would like to discover a way to conditionally execute the replacement path query. That is if users do not enter values for the replacement Query(RP) variables do not execute the replacement path query(RP).
    Does anyone know if this is possible within reason and in customer exit space?
    We have reviewed the situation from all angles and the requirement for the replacement path FUNCTIONALITY and the freedom for the user to leave variable values blank remains.
    I've been searching and reading SDN and SAP notes for about a week and do not find threads which address this situation.
    We are also exploring Customer variable exits to mimic replacement path functionality
    (different topic subject="How do I...Mimic Replacement Path with Query using Customer Variable Exits?")
    Any help will be appreciated
    Many thanks
    David Schuh

    My appologies-I posted this message with the wrong subject. I will repost it with appropriate subject.
    dave schuh

  • Write the following query using JOIN keyword ?

    Qest:
    Write the following query using JOIN keyword ?
    select ID_category from category_master X
    where Exist(select 1 from sub_category Y where
    X.ID_category=Y.ID_category)Edited by: 799660 on Oct 3, 2010 6:05 AM

    select  X.ID_category
      from  category_master X join (select distinct ID_category from sub_category) Y
             on (X.ID_category=Y.ID_category)
    /SY.

  • Issue with Query Region with Table

    All,
    I have a Self Service Page , which has got a Query Region and an underlying Table.
    For the table/ Table Actions Region , I am setting the View Instance and View Attribute Programatically
    OATableBean myRequirementsBean =
    (OATableBean)webBean.findChildRecursive("MyReqTable");
    myRequirementsBean.setViewUsageName(voName);
    OAExportBean exportButtonBean =
    (OAExportBean)webBean.findChildRecursive("ExportButton");
    exportButtonBean.setViewUsageName(voName);
    OAWebBean ssWebBean = webBean.findIndexedChildRecursive("RadioSelect") ;
    ((OASingleSelectionBean)ssWebBean).setViewUsageName(voName);
    ((OASingleSelectionBean)ssWebBean).setViewAttributeName("RadioFlag");
    Followed by prepareForRendering call on Table Bean.
    myRequirementsBean.prepareForRendering(pageContext);
    When I render the Page , I can not see the Table Selection and see the Rows in Table alone.But if I navigate to Personalize View Page and come back to parent Page , I can see the Table Action.
    What could be the reason for this behavior? Please advise.
    Thanks
    Joseph George

    what item does RadioSelect refer to ? is it a child of the table bean ?
    Thanks
    Tapash

  • Issue with Multiple LTS for a fact table and filters

    Hello,
    I am facing an issue with obiee 10g.
    In my model, I have a huge FACT table F1 (partitioned and indexed). The average response time for the queries, which targeted it, was ~30-60 seconds, which was not really convincing our end user.
    So, we decided to create a materialized view, which removes some dimensions that are not used by default, but might be used if the end user adds some filters. I added the Materialized view in the Physical Layer and in the corresponding Logical Table Source.
    I then tried to see if it works, but I was a bit surprised by the result. Indeed,
    -> If the report does not reference a truncated dimension, it targets the materialized view. -> Perfect
    -> If the report does reference a truncated dimension in the columns, it targets the Fact Table. -> Perfect
    -> If the report does reference a truncated dimension in the Filters, it targets the materialized view. For this reason, the filter is never resolved and no join on the dimension table is applied, whereas it exists in logical SQL generated. -> Ko.
    A suggestion could be to add the filters into the columns, but I am not satisfied by this response because it will never use the materialized view in that case.
    An other suggestion could be to use query rewrite, but I 'd like to have the full control on the generation of the queries.
    Does someone know if the filters are not evaluated to determine which LTS to use? How can I force this evaluation?
    Regards,

    Hi,
    If I understand your description correctly, then your materialized view skips some dimensions (infrequent ones). However, when you reference these skipped dimensions in filters, the queries are hitting the materialized view and failing as these values do not exist. In this case, you could resolve it as follows
    1. Create dimensional hierarchies for all dimensions.
    2. In the fact table's logical sources set the content tabs properly. (Yes, I think this is it).
    When you skipped some dimensions, the grain of the new fact source (the materialized view in this case) is changed. For example:
    Say a fact is available with the keys for Product, Customer, Promotion dimensions. The grain for this is Product * Customer * Promotion
    Say another fact is available with the keys for Product, Customer. The grain for this is Product * Customer (In fact, I would say it is Product * Customer * Promotion Total).
    So in the second case, the grain of the table is changed. So setting appropriate content levels for these sources would automatically switch the sources.
    So, I request you to try these settings and let me know if it works.
    Thank you,
    Dhar

  • Performance issues with query input variable selection in ODS

    Hi everyone
    We've upgraded from BW 3.0B to NW04s BI using SP12.
    There is a problem encountered with input variable selection. This happens regardless of using BEx (new or old 3.x) or using RSRT. When using the F4 search help (or "Select from list" in BEx context) to list possible values, this takes forever for large ODS (containing millions of records).
    Using ST01 and SM50 to trace the code in the same query, we see a difference here:
    <u>NW04s BI SQL command</u>
    SELECT                                                                               
    "P0000"."COMP_CODE" AS "0000000032" ,"T0000"."TXTMD" AS "0000000032_TXTMD"                             
    FROM                                                                               
    ( "/BI0/PCOMP_CODE" "P0000" ) LEFT OUTER JOIN "/BI0/TCOMP_CODE" "T0000" ON  "P0000"."COMP_CODE" = "T0000
      "."COMP_CODE"                                                                               
    WHERE                                                                               
    "P0000"."OBJVERS" = 'A' AND "P0000"."COMP_CODE" IN ( SELECT "O"."COMP_CODE" AS "KEY" FROM              
      "/BI0/APY_PP_C100" "O" )                                                                               
    ORDER BY                                                                               
    "P0000"."COMP_CODE" ASC#                                                                               
    <u>BW 3.0B SQL command:</u>
    SELECT ROWNUM < 500 ....
    In 3.0B, rownum is limited to 500 and this results in a speedy, though limited query. In the new NW04s BI, this renders the selection screen unusable as ABAP dumps for timing out will occur first due to the large data volume searched using sequential read.
    It will not be feasible to create indexes for every single query selection parameter (issues with oerformance when loading, space required etc.). Is there a reason why SAP seems have fallen back on a less effective code for this?
    I have tried to change the number of selected rows to <500 in BEx settings but one must reach a responsive screen in order to get to that setting and it is not always possible or saved for the next run.
    Anyone with similar experience or can provide help on this?

    here is a reason why the F4 help on ODS was faster in BW 3.x.
    In BW 3.x the ODS did not support the read mode "Only values in
    InfoProvider". So If I compare the different SQL statements I propose
    to change the F4 mode in the InfoProvider specific properties to
    "About master data". This is the fastest F4 mode.
    As an alternative you can define indexes on your ODS to speed up F4.
    So would need a non-unique index on InfoObject 0COMP_CODE in your ODS
    Check below for insights
    https://forums.sdn.sap.com/click.jspa?searchID=6224682&messageID=2841493
    Hope it Helps
    Chetan
    @CP..

  • How to build a query to join on two tables without mapping

    I did Automatic mapping by the workbench Directofield mapping with the table and java object.
    Wanted to build a simple join query by joining on the same field on both the tables.Not the sql query through the toplink using expression builder.
    Please help.............
    Spent one full day for this................

    Thanks Don for the reply,sorry to bug you,but i need help.....
    SELECT A.AGNCY_C,
         A.TYPE_C,
         A.RESN_C,
         A.S_TYPE_C,
         A.SUB_ID_C,
         A.RY_C
    FROM RATING A, REF B
    WHERE A.ID_C = B._ID_C
    AND A.ALPHA_C = B.ALPHA_C
    AND A.EFF_D >= B.MATURITY_D
    This is the real query i was talking about.I did mapping automatically through the workbench,generated java classes also throught the workbench.
    Now they don't want to execute the raw sql.They wanted to get all the RATING objects with the where condition.
    So how to build a query by using toplink.
    tried your example
    ExpressionBuilder builder = new ExpressionBuilder();
    Expression creditRating = builder.getTable("RATING").getField("ID_C");
    Expression issue_ref = builder.getTable("REF").getField("ID_C");
    Expression join = creditRating.equal(issue_ref);
    I am getting java.lang.OutOfMemoryError
    error.
    I selected the option generate classes and descriptors
    from the tables (RATING,REF).,so it created the classes and dscriptors automatically.
    In Database script for the table RATING like this
    ALTER TABLE RATING ADD (
    CONSTRAINT RATING_F1 FOREIGN KEY (ID_C, ALPHA_C)
    REFERENCES REF (ID_C,ALPHA_C));
    I think when i generate descriptor automatically it is keeping this association.
    Please help me.........

  • About SQL Query using joins

    Hi,
    I want to write a SQL statement using Joins. The base table "A" has about 100 fields and the join table "B" a few. I would like to fetch all fields from table "A" and a few from table "B".
    Is there a way to write a query wherein I can use "Select * " for table "A" rather than writing all 100 field name in the query? Please keep in mind that I want to use a Join.
    Thanks.

    Hi Thomas,
    but if there are some fields which are in both tables, SELECT * will be not sufficient. E.g. fields ERNAM, ERDAT, AENAM, AEDAT are such fields which can occur in more tables. In case that a target area will contain these fields, by * with addition INTO CORRESPONDING FIELDS OF, you are not able to specify from which table these values should be taken. In such case, it can be solved by specifying field list dynamically. If it is not that case SELECT * is sufficient. You should check intersection of common fields for tables you are joining. Thereafter you should decide if you can use SELECT *.
    Maybe for better understanding, what exactly I am talking about, look at this example:
    TYPES: BEGIN OF ts_data,
            ernam TYPE mara-ernam,
           END OF ts_data.
    DATA: ls_data TYPE ts_data,
          ls_mara TYPE mara,
          ls_mchb TYPE mchb.
    START-OF-SELECTION.
      ls_mara-matnr = '1'.
      ls_mchb-matnr = ls_mara-matnr.
      ls_mara-ernam = 'A'.
      ls_mchb-ernam = 'B'.
      INSERT mara FROM ls_mara.
      INSERT mchb FROM ls_mchb.
      SELECT SINGLE * FROM mara INNER JOIN mchb ON mara~matnr = mchb~matnr INTO CORRESPONDING FIELDS OF ls_data.
      ROLLBACK WORK.
    You as a developer are not able to tell from which table common fields should be selected. But maybe this is really too specific case...
    Regards,
    Adrian

  • Performance issue with Query

    11g
    Hi there experts,
      I have an issue with performance with a simple SQL which I thought cannot be tuned but just wanted to check with the experts here. We are running a query to get a persons ID based on his logged in email address from a Parties table which is huge (Millions of records). The query takes about 30 seconds to return a value. Was wondering is there a way to optimize this
    The query is
    {code}
    select par.party_id
    from parties party, users users
    where
    lower(party.email_address) = lower(:USER_EMAIL)
    and party.system_reference = to_char(users.person_id)
    and users.active_flag ='Yes';
    {code}
    The emails are stored in upper and lower, hence the lower functions
    IS creating a function based index the only way?
    Thanks,
    Ryan

    Hi Everyone.
    Thanks and apologies, first post on tuning as such. Here is the explain plan generated through SQL DEVELOPER. IT showed the output in XML
    By the way, looks like the {code} tag does not work?
    {code}
      SELECT STATEMENT
      84903
         HASH JOIN
      84903
         Access Predicates
         PARTY.ORIG_SYSTEM_REFERENCE=TO_CHAR(PERSON_ID)
         TABLE ACCESS
         PER_USERS
      STORAGE FULL
      1059
         Access Predicates
         AND
         ACTIVE_FLAG='Y'
         OR
         OR
         BUSINESS_GROUP_ID=0
         BUSINESS_GROUP_ID=1
         BUSINESS_GROUP_ID=DECODE(SYS_CONTEXT('FND_VPD_CTX','FND_ENTERPRISE_ID'),NULL,BUSINESS_GROUP_ID,TO_NUMBER(SYS_CONTEXT('FND_VPD_CTX','FND_ENTERPRISE_ID')))
         Filter Predicates
         AND
         ACTIVE_FLAG='Y'
         OR
         OR
         BUSINESS_GROUP_ID=0
         BUSINESS_GROUP_ID=1
         BUSINESS_GROUP_ID=DECODE(SYS_CONTEXT('FND_VPD_CTX','FND_ENTERPRISE_ID'),NULL,BUSINESS_GROUP_ID,TO_NUMBER(SYS_CONTEXT('FND_VPD_CTX','FND_ENTERPRISE_ID')))
         TABLE ACCESS
         HZ_PARTIES
      STORAGE FULL
      83843
         Access Predicates
         LOWER(PARTY.EMAIL_ADDRESS)='[email protected]'
         Filter Predicates
         LOWER(PARTY.EMAIL_ADDRESS)='[email protected]'
    {code}
    Purvesh, around 50% are 'Yes'
    Thanks!

  • Issue with Query on a virtual infoprovider

    Hello,
    I am getting the following error message while executing a query on a virtual infoprovider. We have recently gone through upgrade from BI 3.5 to BI 7.0 EHP1 (SP5) and from SEM BCS 4.0 to BCS 6.0.
    EVersion not specified or not unique                                                             UCR0                006                   
    EError reading the data of InfoProvider ZBCS_CV11                                    DBMAN             305ZBCS_CV11          
    EError while reading data; navigation is possible                                          BRAIN               289                   
    I>> Row: 11 Inc: RAISE_READ_ERROR Prog: CL_RSDRV_VPROV_BASE   RS_EXCEPTION        301CL_RSDRV_VPROV_BASE
    this query has been running fine before the upgrade. In the selection screen there are two fields - version1 and version2, if I am specifying same value in both the fields then the query runs fine and if I am providing different values then the above stated error message appears.
    I have tried different settings with properties - Read mode: H,A,X and also different combination from the properties of the virtual infoprovider - with and w/o hierarchies; with and w/o navigation attributes but it did not workout.
    the only thing which has changed on this virtual provider is that I had enabled delta caching as this was supposed to be used in a multiprovider.
    Has anyone experienced similar issue or have an idea as to what is going wrong here. Please advice.
    Regards,
    Manish

    Hi Manish,
    I have exactly the same issue with a query on a virtual infoprovider after upgrading from BI 3.5 to BI 7.0 EHP1 (SP5) and from SEM BCS 4.0 to BCS 6.0.
    Would you be so kind to tell me how you fixed this. (other queries seem to be working)
    Kind regards,
    Jamie Flaxman

  • Issue with Reports using costume measures - BPC 10.0 NW

    Hello BPC Colleagues,
    I’m having a problem with some BPC reports using costume measures and I would like to have your inputs about this issue.
    When all the reports are executed using a costume measures the report execution fails after a long time of execution (7min). The report has 1200 accounts and 57 company codes.
    In order to create trial balance we create these costume measure. Basically the measures are standars (with a few changes) and it works for limited reports (few account and companies) but we I try to executed for several accounts and companies I have the following error:
    “The execution of report Default Report failed. Please contact your administrator.”
    Error while communicating with the server
    Framework message:
    The underlying connection was close: An unexpected error occurred on a receive.
    Summary of the BPC LOG:
    |An error occurred while receiving the HTTP response to https://BPCENV.APPSET.MODEL. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.#
    We already increased the PSAPTEMP table and this didn’t fix the issue. At the beginning we were sure that this was an issue with table space but the error persist.
    I don’t think (maybe I’m wrong) that this is not an issue related to the costume measure or to authorizations since I can retrieve data if I reduce the request to less accounts an company, so in my point of view this looks like a performance issue.
    Just for you, below you will find the details about our measure that generate the problem:
    'IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC",SUM(PERIODSTODATE([%TIME%].[%TIMEYEARLEVEL%], [%TIME%].CURRENTMEMBER), [MEASURES].[/CPMB/SDATA]),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP",SUM(PERIODSTODATE([%TIME%].[%TIMEYEARLEVEL%],[%TIME%].CURRENTMEMBER),[MEASURES].[/CPMB/SDATA]),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="AST",([MEASURES].[/CPMB/SDATA],CLOSINGPERIOD([%TIME%].[%TIMEBASELEVEL%])),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ",([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[%TIMEBASELEVEL%])),[MEASURES].[/CPMB/SDATA]))))';SOLVE_ORDER=3
    Finally is important to mention that we are using BPC 10.0 NW (SP08)
    If you have any suggestion for me I will appreciate.
    Thanks you a lot!

    Hi Vadim,
    Once again, thanks for your help.
    We already modified the YTD standard measure but is with that measure that I have problem. Do you think that my new formula is not efficient and for that reason I’m having this problem? Is this correct?.
    Below you will find the standard and costume measure. In red I marked the difference between these 2 formulas:
    YEAR TO DATE CUSTOME MESURE:
    'IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC",SUM(PERIODSTODATE([%TIME%].[%TIMEYEARLEVEL%], [%TIME%].CURRENTMEMBER), [MEASURES].[/CPMB/SDATA]),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP",SUM(PERIODSTODATE([%TIME%].[%TIMEYEARLEVEL%],[%TIME%].CURRENTMEMBER),[MEASURES].[/CPMB/SDATA]),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="AST",([MEASURES].[/CPMB/SDATA],CLOSINGPERIOD([%TIME%].[%TIMEBASELEVEL%])),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ",([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[%TIMEBASELEVEL%])),[MEASURES].[/CPMB/SDATA]))))';SOLVE_ORDER=3
    YEAR TO DATE STANDAR MEASURE:
    'IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC",SUM(PERIODSTODATE([%TIME%].[%TIMEYEARLEVEL%], [%TIME%].CURRENTMEMBER),-[MEASURES].[/CPMB/SDATA]),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP",SUM(PERIODSTODATE([%TIME%].[%TIMEYEARLEVEL%],[%TIME%].CURRENTMEMBER),[MEASURES].[/CPMB/SDATA]),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="AST",([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[%TIMEBASELEVEL%])),
    IIF([%ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ",-([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[%TIMEBASELEVEL%])),-[MEASURES].[/CPMB/SDATA]))))';SOLVE_ORDER=3
    If you have any suggestion to correct my formula I would really appreciate it.
    Regards,

  • SQL Query Using Join

    Hi,
    I am trying to join two tables using joining.
    SQL> select * from test10;
    ID
    1
    2
    SQL> select * from test11;
    ID
    1
    3
    4
    My expected output is
    ID
    1
    2
    3
    4
    I am able to do this using "Union"
    SQL> select * from test10
    2 union
    3 select * from test11;
    ID
    1
    2
    3
    4
    But i want to achieve this using join. Please help..
    Thanks & Regards,
    Arijit

    Hi, Arijit,
    The way to do that with a join is FULL OUTER JOIN, like this:
    SELECT       NVL (t10.id, t11.id)     AS id
    FROM               test10  t10
    FULL OUTER JOIN  test11  t11  ON   t10.id  = t11.id
    ORDER BY  1
    ;If that's exactly what you're trying to do, you should stick with the UNION.
    FULL OUTER JOIN is good when there are other columns involved.

Maybe you are looking for