Using CASE WHEN for Essbase column in OBIEE 11g

Hi all,
I have a business model in OBIEE 11g, taking the source from Essbase 11. The measures of the Essbase cube in the physical layer is flattened, and the aggregations for the measures are set to SUM.
The Product dimension has 5 generations. In Product logical table, I created a logical column called "Product Grouping" using a simple CASE WHEN formula:
CASE
WHEN "TEST"."Product"."Gen5,Product" IN ('100-10', '100-20', '200-10', '300-10') THEN 'Group 1'
WHEN "TEST"."Product"."Gen5,Product" IN ('100-30', '200-20') THEN 'Group 2'
ELSE 'Group 3'
END
Problems:
1. If I don't place this "Product Grouping" in the logical level/hierarchy, I got error in the report when I simply show Product Grouping and a measure.
2. If I place this "Product Grouping" in the logical level/hierarchy (on the 5th level), no more error in the report when I simply show "Product Grouping" and a measure. The measure value also shows the correct SUM (group by). However, when I add "Gen1,Product" the "Product Grouping" and the measure value suddenly becomes not grouped by.
Has anyone ever tried and encountered something like this? Any thoughts?
Thank you very much!

Hi Deepak, thansk for the suggestion.
However, I can't use calculated item for this report because:
1. incorrect result will be shown when my measures involve a formula to derive a percentage value.
2. calculated item is not available if we do "combine requests" (or union) in 11g.
Any thoughts anyone on how to solve this? Is this just me, or it's a bug?
Thank you very much.

Similar Messages

  • Removing drag functionality of column in OBIEE 11g

    Hi all,
    Can any one say me how to remove the draging functionality for the columns in OBIEE 11g ? It is creating an issue for me when i hide the columns in pivot and has only rows over there. It is creating one more layer on the top of the measures.
    Thanks for your help.

    Fightclub,
    Edit the Pivot view and goto Row section -> Row Properties -> Option - Uncheck the Display Heading.
    But you'll loose your columns heading of rows.
    Thanks,
    Balaa...

  • How to use case when statements in ODI

    I need to put conditional logic before DVM look up in ODI. In the expression editor I put the following statement:-
    CASE WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='RCS' THEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME=EBIZ_CELL.CELL_DATA
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='FDC' THEN CONCAT(POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME,POC_JOURNAL_TEMP_SOURCE_TBL.BOOK_CODE)=EBIZ_CELL.CELL_DATA
    END
    It did not work,
    Under Operators ->All Executions, found the error:-
    905 : 42000 : java.sql.SQLException: ORA-00905: missing keyword
    The description in Session Task contained:-
    select     
         C1_JOURNAL_TEMPL
    from     APPS.POC_JOURNAL_TEMP_SOURCE_TBL POC_JOURNAL_TEMP_SOURCE_TBL, APPS.C$_0POC_JOURNAL_TEMP_TARGET_TB
    where     
         (1=1)
    And (CASE
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='RCS'
    THEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME=C2_CELL_DATA
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='FDC'
    THEN CONCAT(POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME,POC_JOURNAL_TEMP_SOURCE_TBL.BOOK_CODE)=C2_CELL_DATA
    END)
    Checked the above code in PL/SQL Developer but it gave errors.
    In PL/SQL developer tried to check a simple query using case-when but even that is giving errors in the case-when portion.
    The query is as follows:-
    select phase_code, accounting_period, sum(eff_cc) as BD_Eff_QTD
    from prj_detail
    where
    case POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME
    when 'EXT'
    then
    1
    when 'RAC'
    then
    2
    when 'XXX'
    then
    3
    else
    end
    I would like to know what is wrong with the above code.
    Please let me know what is the correct way of using case-when in PL/SQL as well as in ODI.

    Your ODI case statement and PL/SQL Case statement both looks confusing.
    You are writing case statement under where clause which is not a good practise. If you want to implement logic like-
    select a,b,c from <table>
    where
    when cond^n^ 1 then do 1
    when cond^n^ 2 then do 2
    then better you seperate your query for each filter and do a union, in other words-
    select a,b,c from <table>
    where cond^n^ 1
    union
    select a,b,c from <table>
    where cond^n^ 2
    If you are writing case staement to retrieve a value/column (EBIZ_CELL.CELL_DATA) then no need to include it under filter.
    ODI case for column EBIZ_CELL.CELL_DATA will be:
    CASE
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='RCS'
    THEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME
    WHEN POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME='FDC'
    THEN CONCAT(POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME,POC_JOURNAL_TEMP_SOURCE_TBL.BOOK_CODE)
    END
    Pl/SQL query-
    select phase_code, accounting_period,
    case POC_JOURNAL_TEMP_SOURCE_TBL.APPLICATION_NAME
    when 'EXT'then 1
    when 'RAC' then 2
    when 'XXX' then 3
    else 'default value' --- (if no else needed then can also remove else part)
    end,
    sum(eff_cc) as BD_Eff_QTD
    from prj_detail
    Suggested as per what is understood, hope it helps.
    Edited by: 939451 on Jul 5, 2012 12:47 AM
    Edited by: 939451 on Jul 5, 2012 12:48 AM

  • Using case when statement or decode stament in where clause

    hi gems..
    i have a problem in the following query..
    i am trying to use case when statement in the where clause of a select query.
    select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
    cr.salary as salary
    from customer_details cr
    where (case when '>' = '>' then 'cr.salary > 5000'
    when '>' = '<' then 'cr.salary < 5000'
    when '>' = '=' then 'cr.salary = 5000'
    else null
    end);
    the expression in the when clause of the case-when statement will come from UI and depending on the choice i need to make the where clause.
    thats why for running the query, i have put '>' in that place.
    so the original query will look like this(for your reference):
    select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
    cr.salary as salary
    from customer_details cr
    where (case when variable = '>' then 'cr.salary > 5000'
    when variable = '<' then 'cr.salary < 5000'
    when variable = '=' then 'cr.salary = 5000'
    else null
    end);
    so, in actual case,if the user selects '>' then the filter will be "where cr.salary > 5000"
    if the user selects '<' then the filter will be "where cr.salary < 5000"
    if the user selects '=' then the filter will be "where cr.salary = 5000"
    but i am getting the error "ORA 00920:invalid relational operator"
    please help..thanks in advance..

    Hi,
    select cr.customer_name || ' - ' ||cr.customer_number as cust_name,
           cr.salary                                      as salary
    from customer_details cr
    where (    v_variable = 'bigger'
           and cr.salary > 5000
       or (    v_variable = 'less'
          and cr.salary < 5000
       or (    v_variable = 'eq'
            and cr.salary = 5000
           )Edited by: user6806750 on 22.12.2011 14:56
    For some reason I can't write in sql '<', '>', '='

  • Update multiple rows using CASE WHEN

    I have the table ACCOUNT of structure as follow: 
    ACCOUNT_ID
    ACCOUNT_STATUS
    004460721
    2
    042056291
    5
    601272065
    3
    I need to update the three rows at once using one SELECT statement such that, the second column will be 5, 3, 2 respectively.
    I used the following query but seems there is something missing
    UPDATE ACCOUNT
    SET ACCOUNT_STATUS = CASE  
    WHEN ACCOUNT_STATUS = '004460721' THEN 5 
    WHEN ACCOUNT_STATUS = '042056291' THEN 3 
    WHEN ACCOUNT_STATUS = '601272065' THEN 2 
    WHERE ACCOUNT_ID IN ('004460721','042056291','601272065') 
    My question, is this way correct? if no, can I use CASE WHEN statement and how or I only have choice of using SUB-SELECT to acheive that in one statement?

    Hi,
    Hawk333 wrote:
    I have the table ACCOUNT of structure as follow:
    ACCOUNT_ID
    ACCOUNT_STATUS
    004460721
    2
    042056291
    5
    601272065
    3
    I need to update the three rows at once using one SELECT statement such that, the second column will be 5, 3, 2 respectively.
    I used the following query but seems there is something missing
    UPDATE ACCOUNT
    SET ACCOUNT_STATUS = CASE  
    WHEN ACCOUNT_STATUS = '004460721' THEN 5 
    WHEN ACCOUNT_STATUS = '042056291' THEN 3 
    WHEN ACCOUNT_STATUS = '601272065' THEN 2 
    WHERE ACCOUNT_ID IN ('004460721','042056291','601272065') 
    My question, is this way correct? if no, can I use CASE WHEN statement and how or I only have choice of using SUB-SELECT to acheive that in one statement?
    What happens when you try it?
    Did you mean "WHEN ACCOUNT_ID = ..."?
    A CASE expressions always needs an END keyword.
    Depending on your requirements (that is, why are those rows being changed, and how do you determine the new values) a CASE expression in an UPDATE statement, similar to what you posted, could be a good way to do it.  MERGE (instead of UPDATE) would also be an option, especially if you want to avoid updating rows that already happen to have the correct values.

  • Using Case When

    I have a situation where i need to write a case when sql expression to fetch certain rows from a table.
    How to use CASE WHEN THEN ELSE END in a report query ?
    Explanation with a simple example will be of great help.
    thanks

    The javadoc for oracle.toplink.expressions.Expression
    contains some information.
    The following is an example of how to build the case statement.
    This will use case to replace the keys in the caseTable with the values. The default value (the ELSE) is provided as the second argument.
         Hashtable caseTable = new Hashtable(3);
         caseTable.put("Bob", "Bobby");
         caseTable.put("Susan", "Susie");
         caseTable.put("Eldrick", "Tiger");
         Expression expression = builder.get("firstName").caseStatement(caseTable, "No-Nickname").equal("Bobby");

  • How to use case when function to calculate time ?

    Dear All,
    May i know how to use case when function to calculate the time ?
    for the example , if the First_EP_scan_time is 12.30,  then must minus 30 min.  
    CASE WHEN FIRSTSCAN.EP_SHIFT <> 'R1' AND FIRSTSCAN.EP_SHIFT <> 'R2'
    THEN ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF((CASE WHEN SHIFTCAL.EP_SHIFT = 'N1'
    THEN CONVERT(VARCHAR(8),DATEADD(DAY,+1,LEFT(FIRSTSCAN.EP_SCAN_DATE ,8)),112) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','')
    ELSE LEFT(FIRSTSCAN.EP_SCAN_DATE ,8) + ' ' + REPLACE(CONVERT(VARCHAR(8),DATEADD(HOUR,+0,SHIFTDESC.EP_SHIFT_TIMETO + ':00'),108),':','') END),12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0 - 0.25) AS FLOAT),2)
    ELSE ROUND(CAST((DATEDIFF(MINUTE,CAST(STUFF(STUFF(FIRSTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME),CAST(STUFF(STUFF(LASTSCAN.EP_SCAN_DATE,12,0,':'),15,0,':') AS DATETIME)) / 60.0) AS FLOAT),2) END AS OTWORK_HOUR

    Do not use computations in a declarative language.  This is SQL and not COBOL.
    Use a table of time slots set to one more decimal second of precision than your data. You can now use temporal math to add it to a DATE to TIME(1) get a full DATETIME2(0). Here is the basic skeleton. 
    CREATE TABLE Timeslots
    (slot_start_time TIME(1) NOT NULL PRIMARY KEY,
     slot_end_time TIME(1) NOT NULL,
     CHECK (start_time < end_time));
    INSERT INTO Timeslots  --15 min intervals 
    VALUES ('00:00:00.0', '00:14:59.9'),
    ('00:15:00.0', '00:29:59.9'),
    ('00:30:00.0', '00:44:59.9'),
    ('00:45:00.0', '01:00:59.9'), 
    ('23:45:00.0', '23:59:59.9'); 
    Here is the basic query for rounding down to a time slot. 
    SELECT CAST (@in_timestamp AS DATE), T.start_time
      FROM Timeslots AS T
     WHERE CAST (@in_timestamp AS TIME)
           BETWEEN T.slot_start_time 
               AND T.slot_end_time;
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Using number datatype for date column

    Hi
    Is there a side effect for using "number" datatype for "date" column?
    If so, what is the disadvantage?
    Many thanks

    Hi,
    Ora_83 wrote:
    Hi
    Is there a side effect for using "number" datatype for "date" column?
    If so, what is the disadvantage?Yes, there's a definite disadvantage.
    Oracle provides date arithmetic and a number of functions for manipulating DATEs. None of them work with numbers.
    For example,
    SELECT    TRUNC (order_date, 'MONTH')     AS order_month
    ,       AVG (ship_date - order_date)     AS avg_delay
    FROM       orders
    GROUP BY  TRUNC (order_date, 'MONTH')
    ;order_month involves a DATE function; it's pretty easy to find the month that conatins order_date.
    avg_delay involves date arithmetic. It's extrememly easy to find how much the time passed between order_date and ship_date.
    Depending on how you code dates as numbers, doing either one of the above may be just as easy, but doing the other will be very difficult. You'll waste a lot of effort converting the NUMBERs to real DATEs whenever you need to manipulate them.
    Validation can be very difficult for NUMBERs, also.
    Watch this forum. It's a rare day when there's not some question about how to get around a problem caused by storing dates in a NUMBER (or VARCHAR2) column. Don't add to that. Always use DATE columns for dates.

  • How to use case when in Select qry?

    Hi Friends,
    I want to use Case when in Select qry, my situation is like this
    SELECT bmatnr blgort bj_3asiz bmat_kdauf b~mat_kdpos
           SUM( ( case when bshkzg = 'S' then bmenge else 0 END ) -
            ( case when bshkzg = 'H' then bmenge else 0 END ) ) AS qty
           INTO corresponding fields of table it_projsal
        FROM mseg AS b
            INNER JOIN mkpf AS a ON bmblnr = amblnr
                                AND bmandt = amandt
        WHERE abudat  < '20061201' AND blgort IN ('1050')
          and b~mandt = '350'
        GROUP BY bmatnr bj_3asiz bmat_kdauf bmat_kdpos b~lgor
    If we give like this it gives an error.
    Please help me, how to use or handle in select qry itself.
    Regards
    Shankar

    this is not a way to select data from the DB tables.
    first get all the data from the DB tables then u have to do SUM Ups .
    Regards
    prabhu

  • Insert using case when

    hello ,
    i wanna use "case when" statement in the insert , i implement it like this :
    currentyear:=1;
    insert into test1 (ATTRIB1,ATTRIB2) values ((case when currentyear=1 then 'ok' else 'notOK' end),'val2' );
    but it didn't work, i got this error :
    ORA-14551: cannot perform a DML operation inside a query
    Regards
    Elyes
    Edited by: user10393090 on 5 janv. 2009 03:32

    Better approach is ->
    insert into test1 (ATTRIB1,ATTRIB2)
    select case
             when &currentyear=1 then
              'ok'
           else
             'notOK'
           end AS attrib1,
           'val2' AS attrib2
    from dual;N.B.: Not Tested...
    Regards.
    Satyaki De.

  • Stop a dimensional drill for a particular value of a column in obiee 11g

    Hi,
    I have dimensional drill been setup for Supervisor Hierarchy Table.I need to stop the dimensional drill for a particular value of the column in obiee 11g.
    Example: I have two columns
    1.Supervisor Level 1 Name
    2.Supervisor Level 2 Name
    Supervisor Level 1 Name Columns have these values.(Ram,Higher,Sam)
    Supervisor Level 2 Name Columns have these values.(Ravi,Higher,Raghul).
    If we pull Supervisor Level 1 Name Column in report which has a dimensional drill(It will navigate to Supervisor Level 2 Name).It will show
    1.Ram
    2.Higher
    3.Sam
    I should not drill on Higher value but the rest of the values(Sam and Ram will drill to Supervisor Level 2 Name) should be drillable.The same should happen for Supervisor Level 2 Name.
    Please Suggest.
    Thanks,
    Azim

    Azim,
    Don't think you can actually get this working

  • How to use simple types for table column names ?

    Hi,
    can any one tell how to to use simple types for table column names?
    It is required in internationalizing of webdynpro applications.
    Regards,
    Rajesh

    Hi,
    1: define required column names in <SimpleType>
    2:use the following code to get those values
    3:bind 'text' property of Column headers to context attributes
    4:take a context attribute 'Value' as type of <SimpleType>
    5:set these values to context attributes
    IWDAttributeInfo objAttrInfo=wdContext.getNodeInfo().getAttribute(IPrivate<ViewName>View.IContextElement.VALUE);
    ISimpleTypeModifiable simple=objAttrInfo.getModifiableSimpleType();
    Map m=simple.getEnumerationTexts();
    Collection c=m.values();
    Iterator it=c.iterator();
    if(it.hasNext())
    wdContext.currentContextElement.set<att1>(it.next().toString);
    if(it.hasNext())
    wdContext.currentContextElement.set<att2>(it.next().toString);
    if(it.hasNext())
    wdContext.currentContextElement.set<att3>(it.next().toString);
    Regards
    LakshmiNarayana

  • Essbase reports in OBIEE 11g

    Hi Experts,
    The Essbase reports in OBIEE 11g is displaying the member names instead of the Alias names. However in OBIEE 10g the Alias names are rightly displayed.
    Can anyone please suggest on how it is possible to display the alias names in OBIEE 11g?

    Hi,
    thanks for ur reply. I checked the above workaround but found that the option Display Column -> Alias is not enabled. So am not able to select it. Hence now Member names is selected.
    Please let me know if i am missing something else.

  • Peoplesoft Trees as Hierarchial Columns in OBIEE 11g

    Sorry for a duplicate posting. Logged in as a normal user with random number. I know how much people hate it. Logged in as myself now.
    Hi,
    I have extensively searched using Google or 11g docs but could not find a proper solution to using Peoplesoft trees in form of hierarchial columns in obiee 11g. Can the rpd of obiee 11g be designed to view the Peoplesoft tree structure( as it is in Tree manager in Pplsoft) as hierachial columns in obiee 11g? I am sure hierarchial columns as a 11g feature are not just for visual representation in tree format but also can be viewed in Answers and queried against it,am I right?
    Anybody who has worked on trees and OBIEE 11g hierarchial columns? Ahsan/Navin??
    Thanks,
    Dan

    I have not used the 11g hierarchical columns for PSoft Trees but I can think of a glaring reason NOT to do this..PERFORMANCE. If I understand correctly, 11g issues a group by and Union as you traverse this type of structure and PeopleSoft trees have a number of tables to represent the actual TREE. I cannot possibly see how this can be effective especially with a large scale BI Apps DW? This is part of the reason the trees get flattened out via the OOTB ETL adaptors for PSoft.

  • Loop  wirh for using case when

    Hello,
    i wanna use a loop over a select
    but this select depend on a variable value
    so, here is what i did:
    CREATE OR REPLACE Procedure dispatch_pat(perId in number,shortlist_ID in number,orId in number, typeDonnee in number) is
    orVar number(7);
    test number;
    begin
    for orVar in (case when (orId <> 0) then (select OR_ID as id from ordre_regrpmt where or_id=orId) else (select OR_ID as id from ordre_regrpmt where or_id in ( select or_id from DETAIL_SHORT_LIST where ORSHORTLIST_ID=shortlist_ID)) end) loop
    select count(*) into test from ajust_pat where (OR_ID=orVar) and (PER_ID=perId);
    if (test=0) then
    insert into ajust_pat (OR_ID,PER_ID,GENE_ID) values (orVar.id,perId,typeDonnee);
    end if;
    end loop;
    end;
    but i got this error :
    On line: 5
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    Regards
    Sallemel

    Try this code
    /* Formatted on 2009/03/06 08:23 (Formatter Plus v4.8.8) */
    CREATE OR REPLACE PROCEDURE dispatch_pat (
       perid          IN   NUMBER,
       shortlist_id   IN   NUMBER,
       orid           IN   NUMBER,
       typedonnee     IN   NUMBER
    IS
       orvar   NUMBER (7);
       TEST    NUMBER;
    BEGIN
       IF orid = 0
       THEN
          FOR orvar IN (SELECT or_id AS ID
                          FROM ordre_regrpmt
                         WHERE or_id = orid)
          LOOP
             SELECT COUNT (*)
               INTO TEST
               FROM ajust_pat
              WHERE (or_id = orvar) AND (per_id = perid);
             IF (TEST = 0)
             THEN
                INSERT INTO ajust_pat
                            (or_id, per_id, gene_id
                     VALUES (orvar.ID, perid, typedonnee
             END IF;
          END LOOP;
       ELSE
          FOR orvar IN (SELECT or_id AS ID
                          FROM ordre_regrpmt
                         WHERE or_id IN (SELECT or_id
                                           FROM detail_short_list
                                          WHERE orshortlist_id = shortlist_id))
          LOOP
             SELECT COUNT (*)
               INTO TEST
               FROM ajust_pat
              WHERE (or_id = orvar) AND (per_id = perid);
             IF (TEST = 0)
             THEN
                INSERT INTO ajust_pat
                            (or_id, per_id, gene_id
                     VALUES (orvar.ID, perid, typedonnee
             END IF;
          END LOOP;
       END IF;
    END;
    /

Maybe you are looking for

  • Pod worked fine - now it's not... Need help.

    Okay, this may sound foolish but I can't seem to figure it out- Everything was working perfectly (PC – I tunes – Video - I pod). I took my I Pod to work and synced it to my I Tunes there (computer #2). At first I couldn't access any of the songs but

  • Adobe Photoshop quits unexpectedly over and over

    My girl owns a macbook air 4gbRam 256SSD, corei5 and she just install mavericks.. she uses photoshop everyday and after the installation it's constantly crashing and its impossible to work with... Any ideas of how can I solve this situation? Thanks!

  • RFC to XI File -  can NEVER EVER  get more than one record in Output file.

    Hi guys This might be related to my other post on  File conversion but whatever I do I just can't seem to get more than one record in the output file the payload from R3==> XI seems fine for example <?xml version="1.0" encoding="UTF-8" ?> - <rfc:Z_XI

  • Gradient Map uses

    I'm trying to compile a list of uses for the Gradient Map in Photoshop (for my own use and yours). Can you add to the list (please)? If you have a link to an example or a tutorial that would be great as well! Toning images using gradients (e.g. sepia

  • SyncML for the J2ME using Funambol API

    Hi All, I have a problem in SyncML using Funambol API for J2ME. I am sending and getting the contacts from the server but I cannot update them. Suppose I have a First Name field Abc and update it as Xyz it would not change on my server (I am using Fu