MAX function in OBIEE

Hi All
My problem can be summarised as follows:
I have an hr table that stores person information. I am then using this table in my reports. The issue is that
a person can have more than record in the table and because I need to select the latest record for the person, only one record
must be selected. The thing is, by some inherent logic in which the table was developed, the only way the latest record for a person can be selected
is by taking the MAX(SURRO_PERSON_ID) for that person (surrogate key is the primary key for the table and is populated by a sequence, so the max will give the latest record
for that person)
I am creating a complex join in the RPD and since aggregate functions like MAX cannot be used in the expression builder in the RPD, I want to know
if there is a way by which I can achieve this. It would be nice if I could do it in the RPD itself instead of in Answers, but if there is no other way
then it is fine.
Please let me know if you need any more info.
Thanks a lot.

Hi.
As I unerstood the PERSON table has PERSON_ID as primary key. PERSON_INFORMATION table
has many records for one person or per one PERSON_ID so the PERSON_ID is foreign key to PERSON table
and SURRO_PERSON_ID is sequence (PK).
Do this:
View is just select parsed to a database (it's not really a view deployed in database).
Your view PERSON_INFORMATION_V will be something like:
select pi.surro_person_id,
pi.person_id,
pi.*
from person_information pi
where pi.surro_person_id in
(select max(pi.surro_person_id)
from person_information where person_id=pi.person_id)
Of course, you need to put all columns that you need, in the select part.
Now you create FK join from view to a PERSON table in physical layer:
PERSON_INFORMATION_V.PERSON_ID=PERSON.PERSON_ID
One person can have only one row in PERSON_INFORMATION_V.
In the BMM you need to create 2 logical tables.
One is for fact table and second for PERSON table.
In the BMM make complex join between PERSON logical table and fact logical table (before that make FK join between these
two tables in the physical layer PERSON.PERSON_ID=FACT.PERSON_ID).
In the PERSON logical table you will have only one logical table source (PERSON table) and inside it in general tab you
need to add physical table PERSON_INFORMATION_V and physical join to it, you can do this because one person has only one person information.
So in BMM you have one FACT and one dimension (PERSON with PERSON_INFORMATION_V snowflaked inside it.
Hope this helps.
Regards
Goran
http://108obiee.blogspot.com

Similar Messages

  • Applying decode function in obiee 11g

    DECODE(A.AC_CCY,'INR',DECODE(DRCR_IND,'D',-1,1)*A.LCY_AMOUNT,DECODE(DRCR_IND,'D',-1,1)*A.FCY_AMOUNT),
    DECODE(DRCR_IND,'D',-1,1)*A.LCY_AMOUNT,
    Can any one help me how to decode the above sql statement in obiee 11g.
    Edited by: 925104 on Apr 3, 2012 12:48 AM

    you can achieve it by using CASE WHEN condition END function in obiee. nested case also supported by obiee.
    check the below link Decode Join  Condition in OBIEE RPD
    Thanks
    Jay.
    Edited by: Jay on Apr 3, 2012 12:56 PM

  • Converting Decode function in OBIEE

    Hi Guru's
    we are converting some BO reports to OBIEE and need to convert Decode function
    Below is the Decode function they are using:
    Decode ( sign(nvl(BOOKINGS_DATA_UDTC.qty_shipped,0)), 0,decode(BOOKINGS_DATA_UDTC.DELIVERY_NUMBER, 0,decode(BOOKINGS_DATA_UDTC.Schd_Ship_date_fk,to_date('1/1/1990','mm/dd/yyyy'),'Next Month Backlog',decode(sign(nvl(BOOKINGS_DATA_UDTC.Schd_Ship_date_fk, '01-JAN-90') -PAR.PAR_DATE), 1, 'Next Month Backlog', 'Current month will ship')) ,'Awaiting for collection') ,'MTD Shipped')
    i have tried converting into case :
    case when sign(IFNULL("BOOKINGS_DATA_UDTC"."Qty Shipped",0)) = 0 then (case when "BOOKINGS_DATA_UDTC"."Delivery Number" = 0 then (case when "BOOKINGS_DATA_UDTC"."SCHD_SHIP_DATE_FK" = '01-JAN-1990' then 'Next Month Backlog' else (case when Timestampdiff(SQL_TSI_DAY, cast('@{ParDate}{28-DEC-2012}' as Date),(case when "BOOKINGS_DATA_UDTC"."SCHD_SHIP_DATE_FK" IS NULL then CAst('01-JAN-1990' as DATE) else "BOOKINGS_DATA_UDTC"."SCHD_SHIP_DATE_FK" end)) > 1 then 'Next Month Backlog' else 'Current Month Will Ship' end) end) else 'Awaiting For Collection' end) else 'MTD Shipped' end
    But it is not workign as expected.
    Can some one please help me with this.
    Thanks,

    you can achieve it by using CASE WHEN condition END function in obiee. nested case also supported by obiee.
    check the below link Decode Join  Condition in OBIEE RPD
    Thanks
    Jay.
    Edited by: Jay on Apr 3, 2012 12:56 PM

  • How to use Table valued MSSQL  function in OBIEE

    Hi all,
    Can some one help me to understand how to use table valued function in OBIEE? I want to use a table valued function (MSSQL function, with some input parameter), in the physical layer to pull the data?
    I know for MSSQL Stored Procedure we can write as
    EXEC SP_NAME @Parameter = 'VLUEOF(NQ_SESSION.Variablename)'
    but now I have a table valued function in the query window I can get the data as
    select * from myfunction(parametervalue)
    In physical layer of OBIEE I have tried as
    select * from myfunction('VLUEOF(NQ_SESSION.Variablename)'), but I'm getting error as the NQ_SESSION variable doesn't have a value , but actually I have initialized the variable but still Im getting error.
    Can some one help me to solve this.
    Thanks,
    Mithun

    Follow this link and try yourself. let me know for issues
    Substring instr issue in obiee
    Appreciate if you mark
    Edited by: Srini VEERAVALLI on Feb 20, 2013 8:13 AM

  • Issues with integrating Java script functions in OBIEE 11G

    Hello experts..
    I am trying to integrate some Javascript functions in my OBIEE 11G Dashboard..
    I have modified the original common.js file and renamed it as insight_common.js in the following directory (backed up the original file of course)
    OBIEE 11G Folder/user_projects/domains/bifoundation_domain/servers/bi_server1/tmp/_WL_user/analytics_11.1.1/7dezjl/war/res/b_mozilla/insight_common.js
    In my dashboard, I have a dashboard object as text component where I have checked 'Contains HTML Markup'. I have written the following code:
    hello
    <script src="/res/b_mozilla/insight_common.js" type="text/javascript"></script>
    <script type="text/javascript">
    sayHi();
    </script>
    However, when I launch the dashboard, it is not working.
    In the Google Chrome browser as I inspected the element to investigate the reason, I am getting the following error under 'console'
    Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/res/b_mozilla/insight_common.js
    Uncaught ReferenceError: sayHi is not defined saw.dll:611
    It seems that OBIEE is not recognizing the new file that I made..
    Is there a way around this?
    Thanks

    Srini
    I don't have backgrounds in coding, so a lot of what I wrote came from my own researching...
    Now I have tried your latest suggestions again as the below:
    1.<script type="text/javascript" src="res/b_mozilla/insight_common.js">
    sayHi();
    </script>
    and
    2.
    <script type="text/javascript" src="res/test.js"></script> ----- in my case: <script type="text/javascript" src="res/b_mozilla/is_common,js"></script>
    Now both codes this time do not yield any outputs when launching the dashboard. The section is blank and the preview of the Text section in the dashboard is blank as well..
    So, are you sure these are all the steps I need to take to call javascript function in OBIEE?
    Do I need to define anything in weblogic or other places?
    I hope I am not missing any steps..
    Thanks and let me know..

  • How to Avoid Errors in Max Function When Data Contains Blank Cells

    I have a column with duration values. However, it also contains some blank cells. These "blank cells" have formulas in them, but as the cells they reference too are blank the formula doesn't produce a result.>/p>
    I want to get the max value from this column. When I simply do =MAX(column-name) I get an error, presumably because some of the cells are blank. This table is going to be highly dynamic, so I don't want to limit the range of the MAX() function to only those cells with values.
    So does anyone know a solution for this, please? If I was some how able to create a formula which returned the range of cells with actual values, then I could use that in the MAX() function. Or, if I could somehow tell the MAX() function to ignore blank cells, but I'm not sure either of these are possible.
    Thanks,
    Nic

    I don't see a problem with "blank" (null string) cells mixed with duration cells.  MAX works fine with this mix of cells. But if the "blank" cells are numbers, not text, that gives an error.
    A formula always produces a result. A formula cannot result in a blank cell. The closest you can get to "blank" is a null string (the result of two quotes next to each other with nothing between them) . So the question is, what is the result that you are calling "blank"?

  • MAX function

    Hi Everyone,
    Am aware of the following flavors of MAX function
    1) choose MAX from the folders/fields list (selected items tab)
    2) create calculation using: MAX keep dense
    3) create calculation using: MAX analytic function
    questions, pls:
    ===========
    a) with MAX regular, MAX keep dense, MAX - analytic function
    is it necessary to sort it using tools/sort - choose fields to sort by?
    or does the data get sorted due to the ORDER BY clause in MAX used in a calculation
    b) how to understand the diff. bet. MAX keep dense and MAX - analytic function
    1) i understand that analytic functions are applied after detail row processing
    does MAX keep dense calculation happen during detail row processing?
    2) how did you know to advise when to use MAX keep dense, and when to use MAX - analytic function?
    tx for your ideas and assistance, sandra

    Hi,
    a) with MAX regular, MAX keep dense, MAX - analytic function is it necessary to sort it using tools/sort - choose fields to sort by? or does the data get sorted due to the ORDER BY clause in MAX used in a calculationIt is only necessary to use a sort if you want to have the rows returned in a specific order. The order by in the max calculation defines the maximum within the group or window. It may affect the order the rows are returned, but if it does this is not guaranteed and you should use a sort on the main query.
    b) how to understand the diff. bet. MAX keep dense and MAX - analytic function
    1) i understand that analytic functions are applied after detail row processing does MAX keep dense calculation happen during detail row processing?Yes
    2) how did you know to advise when to use MAX keep dense, and when to use MAX - analytic function?In general, if you want the result on a single row, so you have one row for each group then you should use the aggregate max. If you want to use the same max on all the rows in the window (defined by the partition) then use the analytic max.
    Rod West

  • Using max function in PL/SQL

    VERY URGENT...
    Am new to oracle...
    I've written a package that display gif images in form of histogram/bar chart. using html,
    I need to use max function to display values proportionately.
    please help. i need to complete this assignment by 2/9/00 by 10.00 am at the latest. I've half written a function but I don't know if there's a simpler way fo doing this. html enabled

    First of all Thanks to all gentlemen who replied ..many thanks ...
    Tried the ROW_NUMBER() option but still it is taking time...have given output for the query and tkprof results as well. Even when it doesn't fetch any record ( this is a valid cased because the input header id doesn't have any workflow request submitted & hence no entry in the wf_items table)..then also see the time it has taken.
    Looked at the RANK & DENSE_RANK options which were suggested..but it is still taking time..
    Any further suggestions or ideas as to how this could be resolved..
    SELECT 'Y', 'Y', ITEM_KEY
    FROM
    ( SELECT ITEM_KEY, ROW_NUMBER() OVER(ORDER BY BEGIN_DATE DESC) RN FROM
    WF_ITEMS WHERE ITEM_TYPE = 'xxxxzzzz' AND ROOT_ACTIVITY = 'START_REQUESTS'
    AND SUBSTR(ITEM_KEY,1,INSTR(ITEM_KEY,'-') - 1) = :B1
    ) T WHERE RN <= 1
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 0.00 1.57 0 0 0 0
    Fetch 1 8700.00 544968.73 8180 8185 0 0
    total 2 8700.00 544970.30 8180 8185 0 0
    many thanks

  • Evaluate function in OBIEE

    Hi All,
    I tried using Evaluate and Evaluate_Aggr in the column formula of a report.
    Evaluate_Aggr() is erroring saying the dimension Work Order is incorrectlly defines logical Table Source Mapping for a dimension of Work Order. If I revoke the implicit fact coniguration on this Subject Area which I have, the report executes as expected. But this implicit configuration is required in my scenario for other reports to work.
    Using Evaluate() works perfectly.
    Can anyone help me in fixing this?
    Shld I add any other configuration in the RPD to resolve this issue?
    Thanks

    996933 wrote:
    hi all
    i got this error when i try to execute evaluate function in obiee answer
    nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <(>: Syntax error [nQSError: 26012] . (HY000)
    SQL Issued: SELECT DGN_TIME_RES_USAGE_CUBE.DRTCLN_WO_NO, DGN_TIME_RES_USAGE_CUBE.HOURS, DGN_TIME_RES_USAGE_CUBE.PROJ_NO, EVALUATE('FUNC_FIND_EMPLOYEE_DESC(%1,%2,%3)','KASA',DGN_TIME_RES_USAGE_CUBE.DRTCHD_EMP_ID,1), RMAX(DGN_TIME_RES_USAGE_CUBE.DRTCHD_DATE), RMIN(DGN_TIME_RES_USAGE_CUBE.DRTCHD_DATE) FROM LIVE2 years back post from the next time open new thread ? (Business Intelligence Suite Enterprise Edition )
    Thanks,
    Saichand

  • 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.

  • Dense Lookup Function in OBIEE

    Hi ,
    Can someone please explain the syntax of Dense Lookup Function in OBIEE.
    The function in the built-in RPD is using too many arguments and I am not able to understand it.
    Thanks in Advance for the help.
    Akshatha

    I had actually seen all those links. Thanks for your time although.
    Actually, I have an expression like this.
    lookup( DENSE LookupTable.DOMAIN_MEMBER_NAME, 'MCAT', 'CMP' || '~' || Table_A.TOP_LVL_PRODCAT_ID, VALUEOF(NQ_SESSION.USER_LANGUAGE_CODE), Table_A.DATASOURCE_NUM_ID)
    I am not sure of what 'MCAT' and 'CMP' is here?
    Is the || the concatenation operator?
    Can you please explain this expression?
    I hope I am not asking too much here :/
    Akshatha

  • 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.

  • 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.

  • About the filter function in OBIEE 11g

    Hi, all.
    when i use the filter function in OBIEE 11g, it turn out a wrong result.
    The operation steps and detail are described as follow:
    1. In the Column Formula pane, I typed the Formula of the column 'count of customer' as:
    FILTER(count(distinct("customer info dimesion"."customerID")) USING ("TradeType Dimesion"."TradeType" = '001'))
    2. But the phisical SQL about this column in the NQquery file is that: "count(distinct(T11520.CUSTOMERID)) as c5, "
    which means that, the filter wasn't applied, right?
    If so, what shall I do in this situation, in other words , how can i make a Condition COUNT?
    Any Suggestion is appreciated!
    Thank you in advance~~O(∩_∩)O~

    Hi katherine,
    FILTER(count(distinct("customer info dimesion"."customerID")) USING ("TradeType Dimesion"."TradeType" = '001'))I think your formula there is mistake like many braces...instead type this in your f(x)
    =>Filter(count(distinct customer_id) USING trade type='001')
    This filter function is same like a case statement,if you filter still gives error write a case statement
    CASE WHEN TradeType Dimesion.TradeType='001' THEN count(distinct customer info dimesion.customerID) ELSE 0 END
    Will it be helpful?,follow this etiquette http://forums.oracle.com/forums/ann.jspa?annID=939
    By,
    KK

  • 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.

Maybe you are looking for

  • I am reinstalling OS X on a new hard drive but

    I purchased mountain lion OS 10.8 from app store and had it installed on macbook pro. I had to get a new HD but the external HD I'm using to reinstall has Lion 10.7. How can I get a copy of mountain lion OS 10.8?

  • After install infra and mid tier, how do I put into one Farm?

    If I installed the infra , then the mid tier (all on one machine) How do I include the mid tier in the a farm that includes the infra i already installed? How do I link the mid tiers to the infra. I can link to both , which have separate ports 1810 a

  • Formatting current document- x2 A4 sheets into 1 A3 sheet

    Hey guys so i completed a document for a university design project where i need to create like an a4 flip book made by an a3 sheet if that makes any sense, so its just a single a3 sheet that i will print double sided (ends up being 4 A4 pages). Now t

  • Migrating a Flash CS4 project to FlashBuilder

    I'm migrating a Flash CS4 project  to Flash Builder.  My CS4 project has a lot of assets that are assigned  classes in the Flash library.  For example, a graphic in the library has  a class name of MyBitmap, and a base class of  flash.display.BitmapD

  • Could not read detail log from DB12 and DB13

    hi gurus, I am unable to read detail log of onlinebackups and Redolog backups from DB12 and DB13 in my BI sytem what could be the problem. cheers Kumar