Using Trunc Function in OBIEE RPD to TRIM DATE

Below is my requirment.How can i achieve this in BMM layer.
CASE WHEN TRUNC(REPORTDATE) <= TRUNC(SYSDATE-2) THEN 1 ELSE 0 END

Try this
case when cast(REPORTDATE as date)<=cast((current_date-2) as date) then 1 else 0 end
let me know updates
Thanks
http://cool-bi.com
Edited by: Srini VEERAVALLI on May 22, 2013 9:29 AM

Similar Messages

  • How to use rank function in obiee rpd using evalute..

    i created a logical column:
    EVALUATE('RANK() OVER (PARTITION BY %1,%2)' AS DOUBLE PRECISION , Composites.Composites_Fact.MEMBER_LOCKED_BASE_RETURN, Composites.Composites_Fact.COMP_ID)
    please provide some solution

    There is a known bug with EVALUATE when returning numbers. When I has the same problem Oracle Metalink has adviced to use CAST on the end result of the EVALUATE and return it as a FLOAT datatype.
    CAST(EVALUATE('my_function(%1)', logical_table.ROWID) AS FLOAT)

  • How to use TRUNC function with dates in Expression Builder in OBIEE.

    Hi There,
    How to use TRUNC function with dates in Expression Builder in OBIEE.
    TRUNC (SYSDATE, 'MM') returns '07/01/2010' where sysdate is '07/15/2010' in SQL. I need to use the same thing in expression builder in BMM layer logical column.
    Thanks in advance

    use this instead:
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(CURRENT_DATE) * -1) + 1, CURRENT_DATE)

  • Use EVALUATE function in obiee

    Hi ALL
    i hv a database query like this;
    select
    deptno,
    rtrim (xmlagg (xmlelement (e, ename || ',')).extract ('//text()'), ',') enamesfrom
    emp
    group by
    deptno;
    now, i want to use this using Evaluate function in obiee column formula.
    thn how to do it.
    Please reply.
    THX
    SAP

    Hello SAP,
    I have seen you for sometime and one thing I came to know is you are creating threads and once you got your solution or you dont feel to follow up you are just leaving the thread.
    see few here,
    Sorting month name
    Drill down problem
    Re: Filter in Union Request
    so please better close the threads which are answered and proceed further.

  • How to use CAST function in obiee 11g in rpd

    Hai,
    I am trying to use the cast fucntion in rpd in bmm layer for a new logical column that I have created and is giving me error compile message.
    Can any one please help me out or find out what is wrong in the function I am using.
    The expression I am trying to use is
    ( CAST ( "Chase Card Acquisition"."Fact Deposit"."Base Earn" as decimal(18,0) ) + "Chase Card Acquisition"."Fact Deposit"."Tot Bonus Earn" )

    Decimal is not a supported type in the logical layer. See:
    http://docs.oracle.com/cd/E21764_01/bi.1111/e10540/sqlref.htm#BIEMG559
    for supported types.
    If you are casting as Int then do not specify the precision ('cast x as int' NOT 'cast x as int(y,z)'). Regards,
    Robert

  • How does one access custom function in OBIEE RPD for Session Init Block SQL

    Hello:
    We are using SSO for authentication and authorization for OBIEE, using Init Blocks in the RPD and httpHeader as the source of variables in the Instanceconfig.xml file. (As long as the user is member of one group, the results are fine. However, as soon as the user is assigned to multiple groups, group values become URI-encoded.)
    To solve the problem of URI-encoding, we have deployed a function to the DB (ora 10gr2).
    The problem I am running into is that when I call the function from an Init Block (Security), OBIEE Presentation Services (OPS) acts as though the function does not exist or is not called.
    Initialization String: select group_OBIEE(WEBGROUPS) from dual
    ("group_OBIEE" is the function that was deployed.)
    Testing: Successfully tested the function in PL/SQL as well as using the Test button in RPD.
    Reason for the fuction: The function decodes the extra characters using a substr function. SSO uses Shibboleth for Authentication and Authorization.
    For example, for our group name, we expect to obtain the following value:
    edw:hrdir;edw:findir (2 groups separated by a semi-colon)
    However, we are obtaining the following: (Determined via the narrative view in Answers: @{biServer.variables['NQ_SESSION.GROUP']} )
    URI-ENCODED&lt;edw%3ahrdir%3bedw%3bfindir&gt;
    Please note: There are no such problems when we are passing only a single group value (i.e. edw:hrdir). So, in cases when we pass only for Group for the user, we are able to authenticate and authorize w/o a problem.
    Any suggestion on how to call the function or a better way to approach this problem?
    Thanks in advance for your help.

    You don't need a function to assign the groups in your Init Block. In fact you should not use it. You need to use a standard select and define the Init Block as Row-Wise. This means the BI Server knows the Init Block will return more than one row. You select statement should look like this:
    SELECT 'GROUP', YOUR_GROUP_NAME FROM YOUR GROUP_USERS_TABLE WHERE YOUR_USER_ID_COLUMN = ':USER'

  • How to use CHOOSE function in OBIEE

    Hi,
    Could any one help me out in using the choose function in OBIEE.
    How can a column be restricted using the choose function, when different users belonging to different groups logs in.
    Rakesh

    It seems be obvious that you should not publish reports to users and groups who are not allowed to see the columns in the report,
    but in practice it can be very challenging to oversee this, especially when you have a lot of groups and a very strict security model....or "unsurmountable" and unchangeable "business requirements" ;-)
    Testing definitely is the crucial point. And when you start going nuts with column access rights plus column selectors, dynamic view switching, guided nav., dynamic column formulae etc. etc. the fun really begins.

  • Using TRUNC function on partitioned column

    Hi All,
    I have a table as follows:
    STEP1
    CREATE TABLE TEST_PARTITION
    EMP_ID VARCHAR2(10 BYTE),
    CREATE_DT DATE,
    EMP_RGN_NM VARCHAR2(2 BYTE),
    DSPTCH_CNT NUMBER
    PARTITION BY RANGE (CREATE_DT)
    SUBPARTITION BY LIST(EMP_RGN_NM)
    SUBPARTITION TEMPLATE(
    SUBPARTITION RGN_E VALUES ('E') ,
    SUBPARTITION RGN_MW VALUES ('MW') ,
    SUBPARTITION RGN_SW VALUES ('SW') ,
    SUBPARTITION RGN_W VALUES ('W') ,
    SUBPARTITION RGN_SE VALUES ('SE')
    PARTITION aug2008 VALUES LESS THAN (TO_DATE('01-Sep-2008', 'DD-MON-YYYY')),
    PARTITION sep2008 VALUES LESS THAN (TO_DATE('01-Oct-2008', 'DD-MON-YYYY')),
    PARTITION oth VALUES LESS THAN (MAXVALUE)
    ENABLE ROW MOVEMENT;
    STEP 2
    insert into TEST_PARTITION values(1000,TO_DATE('01-Aug-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',10)
    insert into TEST_PARTITION values(1000,TO_DATE('02-Aug-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',20);
    insert into TEST_PARTITION values(1000,TO_DATE('03-Aug-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',0);
    insert into TEST_PARTITION values(1000,TO_DATE('01-sep-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',10);
    insert into TEST_PARTITION values(1000,TO_DATE('02-sep-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',10);
    insert into TEST_PARTITION values(1000,TO_DATE('01-Oct-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',10);
    insert into TEST_PARTITION values(1001,TO_DATE('01-Aug-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',1);
    insert into TEST_PARTITION values(1001,TO_DATE('02-Aug-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',2);
    insert into TEST_PARTITION values(1001,TO_DATE('03-Aug-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',0);
    insert into TEST_PARTITION values(1001,TO_DATE('01-sep-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',10);
    insert into TEST_PARTITION values(1001,TO_DATE('02-sep-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',5);
    insert into TEST_PARTITION values(1001,TO_DATE('01-Oct-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',10);
    insert into TEST_PARTITION values(1001,TO_DATE('02-Oct-2008 12:02:02', 'DD-MON-YYYY HH:MI:SS'),'SE',10);
    STEP 3
    I need to get all the dispatches on 1st of August and hence issue the statement as follows:
    select * from test_partition where TRUNC(CREATE_DT)='01-Aug-2008' and EMP_RGN_NM = 'SE'
    Using a function over the partitioned column, will it avaoid partition pruning? I mean will it scan all the partitiones instead of going to specific partition?
    I need this urgently since we are having a discussion on this in few minutes from now.
    Thanks so much
    Saff

    What about a function based index ?
    SQL> select * from test_partition where TRUNC(CREATE_DT)='01-Aug-2008' and EMP_RGN_NM = 'SE';
    Execution Plan
    | Id  | Operation              | Name           | Rows  | Bytes | Cost (%CPU)| Pstart| Pstop |
    |   0 | SELECT STATEMENT       |                |     1 |    32 |     4   (0)|       |       |
    |   1 |  PARTITION RANGE ALL   |                |     1 |    32 |     4   (0)|     1 |     3 |
    |   2 |   PARTITION LIST SINGLE|                |     1 |    32 |     4   (0)|   KEY |   KEY |
    |   3 |    TABLE ACCESS FULL   | TEST_PARTITION |     1 |    32 |     4   (0)|   KEY |   KEY |
    Note
       - 'PLAN_TABLE' is old version
    SQL> create index idx on test_partition (TRUNC(CREATE_DT));
    Index created.
    SQL> select * from test_partition where TRUNC(CREATE_DT)='01-Aug-2008' and EMP_RGN_NM = 'SE';
    Execution Plan
    | Id  | Operation                          | Name           | Rows  | Bytes | Cost (%CPU)| Pstart| Pstop |
    |   0 | SELECT STATEMENT                   |                |     1 |    32 |     2   (0)|       |       |
    |   1 |  TABLE ACCESS BY GLOBAL INDEX ROWID| TEST_PARTITION |     1 |    32 |     2   (0)| ROWID | ROWID |
    |   2 |   INDEX RANGE SCAN                 | IDX            |     1 |       |     1   (0)|       |       |
    Note
       - 'PLAN_TABLE' is old version
    I need this urgently since we are having a discussion on this in few minutes from now.It is not our problem, but yours.
    Nicolas.

  • Unable to use WriteBack function in OBIEE on a Unix setup

    Hi All
    I am trying to implement the writeBack function in OBIEE. We have OBIEE installed on a Unix machine. Below is the xml that I have writte, it keeps erroring stating that the xml file cannot be read.
    <?xml version="1.0" encoding="utf-8" ?>
    <WebMessageTables xmlns:sawnm="com.siebel.analytics.web/message/v1">
    <WebMessageTable lang="en-us" system="WriteBack" table="Messages">
    <WebMessage name="forecast">
    <XML>
    <writeBack connectionPool="MOM_BI">
    <Insert></Insert>
    <Update>UPDATE STORE SET STORE_NAME='{@c1}' WHERE STORE={@c0}</Update>
    <postUpdate>COMMIT</postUpdate>
    </writeBack>
    </XML>
    </WebMessage>
    </WebMessageTable>
    </WebMessageTables>
    Below is the log that I've received from OBIEE:
    Error loading XML Message File (/app/oracle/product/OBIEE10133/OracleBI/web/msgdb/CustomMessages/forecast.xml): Sax parser returned an exception.
    Message: Invalid document structure, Entity publicId: /app/oracle/product/OBIEE10133/OracleBI/web/msgdb/CustomMessages/forecast.xml, Entity systemId: , Line number: 2, Column number: 1^M
    Error Codes: UH6MBRBC^M
    Could you please let me know what is wrong with my xml file? By the way I only want to do an update to my table. Also I have followed all the examples from Venkat and others but I stil cannot get it to work.
    Regards
    Adnan

    It's already good to know that the file gets picked up.
    What I don't understand: "The log files are not being updated with the error however when I re-save my Answer it is populating the log file to state that the object already existed."?
    I had to put a fake "insert" statement to get it working once. Here's the example:
    <?xml version="1.0" encoding="utf-8"?>
    <WebMessageTables xmlns:sawm="com.siebel.analytics.web/message/v1">
    <WebMessageTable lang="en-us" system="WriteBack" table="Messages">
    <WebMessage name="ELT_Upside">
    <XML>
    <writeBack connectionPool="ELT_Writeback_Pool">
    <update> UPDATE T_DW_LOGIC_ELT_UPSIDE SET COMMENTS='@{c0}', AMOUNT=@{c1}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where UPSIDE_COMMENT_ID=@{c2} </update>
    <insert> UPDATE T_DW_LOGIC_ELT_UPSIDE SET COMMENTS='@{c0}', AMOUNT=@{c1}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where UPSIDE_COMMENT_ID=@{c2} </insert>
    </writeBack>
    </XML>
    </WebMessage>
    <WebMessage name="ELT_Downside">
    <XML>
    <writeBack connectionPool="ELT_Writeback_Pool">
    <update> UPDATE T_DW_LOGIC_ELT_DOWNSIDE SET COMMENTS='@{c0}', AMOUNT=@{c1}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where DOWNSIDE_COMMENT_ID=@{c2} </update>
    <insert> UPDATE T_DW_LOGIC_ELT_DOWNSIDE SET COMMENTS='@{c0}', AMOUNT=@{c1}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where DOWNSIDE_COMMENT_ID=@{c2} </insert>
    </writeBack>
    </XML>
    </WebMessage>
    <WebMessage name="ELT_Outlook">
    <XML>
    <writeBack connectionPool="ELT_Writeback_Pool">
    <update> UPDATE T_DW_LOGIC_ELT_OUTLOOK SET AMOUNT=@{c4}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where OUTLOOK_COMMENT_ID=@{c0} </update>
    <insert> UPDATE T_DW_LOGIC_ELT_OUTLOOK SET AMOUNT=@{c4}, LAST_UPDATED_BY='@{c6}', LAST_UPDATE_DATE=TO_TIMESTAMP('@{c7}', 'YYYY-MM-DD HH24:MI:SS.FF3') where OUTLOOK_COMMENT_ID=@{c0} </insert>
    </writeBack>
    </XML>
    </WebMessage>
    </WebMessageTable>
    </WebMessageTables>
    Cheers,
    C.

  • How to use groupby function in OBIEE ANSWERS ???

    Hi ,
    I need to find TOP 1000 client names on each product and I need to group the data by product. I am unable to group the data in Answers , I dont have access to the repository.
    I used the Top function but unable to group the data. Please help me...

    Why didn't using TOP work for you? What kind of results did you get?
    I can also suggest using custom ColumnCount with RSUM () in it, applying filter RSUM()<=1000, and sorting by product amount DESC
    and definitely your column order should be something like this - product group, client, product_amt, rowcount (you can actually remove this once you create filter for it)

  • Percentile_Disc Function in OBIEE 10g - Help needed at the earliest

    Hi All,
    I have a requirement of using PERCENTILE_DISC function in OBIEE 10g repository. I tried NTile function, to fetch the percentile. But that is not what am intending to see.
    I have a requirement something similar to this, to be implemented in repository. Could anyone throw some light in this regard?
    PERCENTILE_DISC(.25) WITHIN GROUP (ORDER BY F.Days asc) OVER (PARTITION BY A.NAME, B.PLACE)
    Here F = Fact
    A = 1st Dimension
    B = 2nd Dimension
    Days = Is calculated as TIMESTAMPDIFF(SQL_TSI_DAY, A.DATE, B.DATE). Established Inner Join, to fetch this calculation in to the FACT
    Appreciate your responses at the earliest. Thanks once again.
    Regards,
    Sarat Nallapati

    Hi,
    I don't have any idea on percentile_disc.
    But,in OBIEE we have a function PERCENTILE()
    It will give the percentage of each value in the total sum of all the values.
    once check it.
    Regards,
    Lakshmipathi.

  • Best practices on using EVALUATE functions

    hi, experts,
    I wanna know what is the best practices on using EVALUATE functions on obiee (calling oracle user defined functions)
    I found that if I use evaluate functions in Answers,
    obiee will construct a sql behind and then execute.
    sometimes, obiee contructs some unexpected sqls, and returns errors.
    so, is it better to use EVALUATE functions in logical columns ?
    thanks

    EVALUATE('DB_Function(%1)' as returntype, {Comma separated Expression})
    even when used in Logical columns, its gonna fire the same sql.

  • How to use EVALUATE_AGGR function

    Hi,
    How to use this function in OBIEE
    EVALUATE_AGGR('db_agg_function(%1...%N)' [AS datatype] [, column1, columnN])

    Hi solved,
    i have 3 rows as
    a
    b
    c
    i want to get a,b,c for that i used below code
    EVALUATE_AGGR('LISTAGG(%3) WITHIN GROUP (order BY %1,%2 DESC)',"KQ_TASK"."ASSIGNED_TO",',',"KQ_TASK"."ASSIGNED_TO")
    where %3 is third column which u want to get in single row

  • Using TRUNC in timestamps

    Sir,
    As you know we were using TRUNC function in DATE datatype. But I want to use it with TIMESTAMP datatypes. For example:
    select trunc(systimestamp,'hh24:mi:ss') from dual;
    The main idea to get some part of given timestamp without using type conversions (i.e. TO_CHAR).
    Note that this is useful when you want to ADD or Subtract the time side from timestamp with interval values and comparing them to another timestamps fields or values.
    Thank you in advance.

    Trunc is not working in 9i
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> SELECT current_timestamp - TRUNC (current_timestamp) time
    2 FROM dual
    3 /
    SELECT current_timestamp - TRUNC (current_timestamp) time
    ERROR at line 1:
    ORA-00932: inconsistent datatypes: expected NUMBER got TIMESTAMP
    SQL>
    But in 10g...
    Personal Oracle Database 10g Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> SELECT current_timestamp - TRUNC (current_timestamp) time
    2 FROM dual;
    TIME
    +000000000 14:53:04.941000
    SQL>
    Why?

  • Usage of TAble Functions in OBIEE

    Hello All,
    I have created a table function in the database.
    Is it possible to use/call table functions in obiee.Please let me know how to use table functions in OBIEE.
    Thanks in advance.

    Hi,
    Thanks for your reply.
    I want to use this table function to generate answers report.
    In the query i am using unions,bind variables.I can not create a database view on this query.The best solution would be creating a table function.
    But,i do not know how to access/use/call this table function to create answers report.
    Thanks in advance.

Maybe you are looking for

  • Partner Function for STO and relevant inbound delivery

    Dear Expert, i did the partner configuration for Vendor and STO with partner VN-vendor DP-delivery plant. When i create the STO vendor UP07, both of VN and DP are UP07, but when i create the STO for UP07, no partner data come out for the PO, the part

  • Time device integration with SAP TM

    Hi, Can anyone guide me to integrate a hand punching time device with SAP Time management such that the time events can be recorded on batch processing from the device and validate it in SAP and generate the reports. We are working with SAP 4.7 versi

  • Line Graph date format

    Hi, I Created line graph x axis date y axis amount The date format is not showing correctly For Ex : date range : 01-Jan-2011 to 10-jan-2011 in graph x - axis firsi date is showing 01-Jan-2011 and remaining dtaes are showing only days like 02 03 04 h

  • Displaying Images In Dreamweaver

    when I view an page in either SPLIT or DESIGN view using Dreamweaver 8 it does not display the actual images or embedded video instead it shows the outline of the image as a grey box. I know it can be done but cannot find the option to display. How c

  • Rename Issue

    Hello everyone, I went to "manage presentation catalog" and renamed a report, then i went to a dashboard to add that report. But to my surprise the report had the old name! I´ve restarted the services and it still shows the old name but when I go to