5y5

11
1/29/13 OBIEE « Carpediemconsulting’s Blog carpediemconsulting.wordpress.com/category/obiee/ 1/11 C arpediemconsulting’s Blog R ow wise initialized variable in OBIEE 11g and VALUELISTOF function Posted on November 24, 2010 by carpediemconsulting OBIEE up to 10g had a limitation around session variables which are row wise initialized ,in that you cannot use that variable to initialize another subsequent session variable. Good news!! 11g seems to have a fix for this. For e.g. lets say you have a session (row wise initialized) variable called “REGION” initialized as follows select ‘REGION_LIST’ ,region_id from region_table. Now lets say you want to initialize another row wise initialized variable based on the ‘REGION_LIST’ variable you had initialized earlier. For e.g. all the accounts belonging to the ‘REGION_LIST’ variable. Here is the new way of doing it in 11g select ‘ACCOUNT_LIST’ ,account_id from accounts where region_id in (VALUELISTOF(NQ_SESSION.REGION_LIST)). Keep in mind this will go back to the database as an in list, coma separated and the values would be in single quotes. Filed under: OBIEE , OBIEE 11g | Tagged: obiee 11g , row wise initialization , session variables | Leave a Comment » D ynamic Display Name for Presentation columns Posted on June 15, 2009 by carpediemconsulting There was a question asked on this post here

Upload: chakri-reddy

Post on 08-Aug-2015

17 views

Category:

Documents


1 download

DESCRIPTION

yhj

TRANSCRIPT

Page 1: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 1/11

Carpediemconsulting’s Blog

Row wise initialized variable in OBIEE 11g andVALUELISTOF function

Posted on November 24, 2010 by carpediemconsultingOBIEE up to 10g had a limitation around session variables which are row wise initialized ,in thatyou cannot use that variable to initialize another subsequent session variable. Good news!! 11gseems to have a fix for this.

For e.g. lets say you have a session (row wise initialized) variable called “REGION” initialized asfollows

select ‘REGION_LIST’ ,region_id from region_table.

Now lets say you want to initialize another row wise initialized variable based on the‘REGION_LIST’ variable you had initialized earlier. For e.g. all the accounts belonging to the‘REGION_LIST’ variable.

Here is the new way of doing it in 11g

select ‘ACCOUNT_LIST’ ,account_id from accounts where

region_id in (VALUELISTOF(NQ_SESSION.REGION_LIST)).

Keep in mind this will go back to the database as an in list, coma separated and the values wouldbe in single quotes.

Filed under: OBIEE, OBIEE 11g | Tagged: obiee 11g, row wise initialization, session variables |Leave a Comment »

Dynamic Display Name for Presentation columns

Posted on June 15, 2009 by carpediemconsulting

There was a question asked on this post here

Page 2: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 2/11

There was a question asked on this post here(http://carpediemconsulting.wordpress.com/2008/11/25/choose-and-indexcol-functions-in-obiee/)and I thought of having another post to answers Vik’s question.

Hi carpediemconsulting

Good Artical, Thanks

We have a Similar req at my client, but little bit different.

we have a Dimension, in that we have a hierarchy H1 with Levels, Level1, Level 2 , Level 3 we areimplimenting this product for different companies, Lets say comp A, & Comp B,In Comp ‘A’ we call level 1 as ‘Market’ and in comp ‘B’ we call it as “Location”can we change these Level1 label dynamically when the user login. FYI . these labels are stored inTABLE

ThanksVik

As you can see from the properties of a presentation column you could see that there is a provisionto specify a custom display name.

I have two users created in the RPD. USER1 and USER2. My objective is to give a custom displayname for a Column (Brand column in the Product Table). User1 would like the display to beUSER1 BRAND and user2 USER2 BRAND.

I have created a session variable (BRAND_DISP_NAME) which would be initialized to USER1BRAND for user1 and USER2 BRAND.

In the properties window for the presentation column brand do the following.

Uncheck use logical table Name check box

Check the Custom Display Name check box

Type in the name of the session variable in the text box. In my caseVALUEOF(NQ_SESSION.BRAND_DISP_NAME)

Here is a screenshot.

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image0021.jpg)

Now lets see how the column shows up for these 2 users in Answers.

USER 1

Page 3: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 3/11

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image0041.jpg)

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image0061.jpg)

As shown in the screenshots above the display name for the column “brand” is different for thesetwo users.

Hope this answers Vik’s question.

Filed under: BI, OBIEE | Tagged: OBIEE | Leave a Comment »

Dynamic Data security in OBIEE

Posted on March 5, 2009 by carpediemconsultingHere is an interesting scenario that I came across recently. The client has 2 hierarchies based oncost centers, Management and P&L. The business push behind this was that lot of users had dualroles in terms of how they look at expenses. Both the hierarchies had cost center at the lowestlevel and the same number of levels in the hierarchy. The differences were 1) users wouldhave access different set of cost centers in both hierarchies (not necessarily mutually exclusive) 2)roll ups for the cost centers would be different in both hierarchies. The business had a couple ofrequirements around this.

1) The users should be able to pick the hierarchy that they would like to view the report by.

2) When the user flips between the hierarchies the security applied should change accordingly, ieif they are viewing the report by the P&L hierarchy then the P&L security should be applied andif they pick management then Management hierarchy security should be applied.

Here is a very simplified version of how we implemented the solution.

The security profile table

Hierarchy User_id Cost_center

Page 4: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 4/11

P&L USER1 1

P&L USER1 2

P&L USER1 3

P&L USER1 4

MGMT USER1 3

MGMT USER1 4

MGMT USER1 5

MGMT USER1 6

MGMT USER1 7

User1 has access to cost centers 1-4 in the P&L hierarchy and 3-7 in the Management Hierarchy.

Here are the 2 hierarchy tables for this example.

Hierarchy Cost_center Level2 Level1

P&L 1 P&LLVL2 1

P&L LVL11

P&L 2 P&LLVL2 1

P&L LVL11

P&L 3 P&LLVL2 1

P&L LVL11

P&L 4 P&LLVL2 1

P&L LVL11

P&L 5 P&LLVL2 2

P&L LVL11

P&L 6 P&LLVL2 2

P&L LVL11

P&L 7 P&LLVL2 2

P&L LVL11

Hierarchy Cost_center Level2 Level1

MGMT 1 MGMTLVL2 1

MGMTLVL1 1

MGMT 2 MGMTLVL2 1

MGMTLVL1 1

MGMT 3 MGMTLVL2 1

MGMTLVL1 1

MGMT 4 MGMTLVL2 2

MGMTLVL1 1

MGMT 5 MGMTLVL2 2

MGMTLVL1 1

Page 5: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 5/11

MGMT 6 MGMTLVL2 2

MGMTLVL1 1

MGMT 7 MGMTLVL2 2

MGMTLVL1 1

I have an expenses fact table where the cost center is a key.

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image0022.jpg)

Now lets see how this is modeled in the RPD.

Physical Layer Joins

I have aliased the security profile table as Sec Profile PL and Sec Profile Mgmt

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image0042.jpg)

There is a similar join between the Sec Profile Mgmt table with the Management Hierarchy table.

Here is how the BMM layer is done.

The cost center table will have 2 logical sources and each of these logical sources would have aninner join to the appropriate sec profile alias table.

Page 6: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 6/11

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image0062.jpg)

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image0081.jpg)

All the columns are mapped to both the logical sources.

Now we need to define appropriate fragmentation content for these 2 logical sources. Here is theMgmt source

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image0101.jpg)

Add the user_id column to the logical table and map it to the appropriate logical sources.

Now all that’s left is to go to the relevant group in the RPD and add the security filter.

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image012.jpg)

Create reports with the hierarchy as one of the columns and set filter to a presentation variable

Page 7: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 7/11

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image014.jpg)

Also create a prompt and set a presentation variable in the prompt.

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image016.jpg)

Throw the 2 in a dashboard and lets see how the reports work for USER1

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image018.jpg)

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image020.jpg)

Its very important to have the filter on the hierarchy column in every query otherwiseyou would end up overstating the numbers.

Filed under: BI, Data Warehousing, OBIEE | 2 Comments »

Letting the users pick joins in OBIEE

Posted on January 25, 2009 by carpediemconsultingThe users want to define the joins between tables in answers, when doing adhoc queries. Theseviews are used for real-time reporting and were sitting on top of EBS tables. This requirement wasdriven by the fact that most of these views could be joined in more than 2 ways depending of thebusiness scenario. In a typical design we would create alias tables to correspond to each of the

Page 8: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 8/11

joins. But in our case the users were not able to define the joins in advance and there is apossibility of the view definitions changing over a period of time. To sum it up the users wanted tosimulate a SQL tool with answers, sort of.

(http://carpediemconsulting.files.wordpress.com/2010/01/clip_image002.jpg)

In our case View 1 and View 2 could be joined up to 4 different ways and there were quite a fewviews like that, making the whole aliasing approach cumbersome. One of the developers in theteam came up with an idea, though it’s not the perfect solution, but definitely simple and worthmentioning.

First up we extended all the views in the database by adding a dummy column and the valueswere always 1.

View 1

Col1 Col2 Col3 Col4 Dummy

1

1

View2

Col1 Col2 Col3 Col4 Dummy

1

1

The physical layer in the RPD would have the join between the views as View1.dummy =View2.Dummy. There is nothing special about the BMM layer, the usual and the same with thepresentations layer.

Now comes the answers part. If I were to run a query between the 2 views without any filters inthe query the results would not make any since the join is View1.dummy = View2.Dummy.

Let’s say for query 1 I want to join on View1.col1 = View2.col1. Here are the steps.

Put a filter on View1.Col1. (View1.Col1 = value1)

Convert that filter to SQL

Equate View1.Col1 to View2.Col2 in the filter SQL.

Page 9: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 9/11

(http://carpediemconsulting.files.wordpress.com/2010/01/clip_image004.jpg)

This will have your physical queries appended by 2 join conditions 1) which is defined in theRPD(View1.dummy = View2.Dummy) and 2) View1.col1 = View2.col1 .

You could define any joins in a similar fashion. One serious limitation is that the joins are alwaysinner joins.

Filed under: BI, Data Warehousing, OBIEE | 2 Comments »

Period Comparison without time series orago functions.

Posted on January 8, 2009 by carpediemconsultingRecently at a client site we had to connect to some tables in owned by another application andgenerate some reports for our OBIEE user base. We had no control over the table structures in theexternal application and we had to generate some time series measures. We couldn’t use the timeseries wizard or the ago functions provided by OBIEE.

The report had to display all the quarters of the current year and the growth for the same periodfor each of the quarters.

This is how the repots looks like in a regular table view in answers.

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image002.jpg)

And the picture below shows what the client wanted.

Page 10: 5y5

1/29/13 OBIEE « Carpediemconsulting’s Blog

carpediemconsulting.wordpress.com/category/obiee/ 10/11

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image004.jpg)

We could have done the same with a complex case expression but we found an alternative whichis more elegant and better performing, using pivot table calculations.

First up we need to change the formula for the quarter to the one shown below.

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image006.jpg)

Current year is a repository variable, this could also have been a presentation variable.

And the table view would look like

(http://carpediemconsulting.files.wordpress.com/2009/11/clip_image008.jpg)

Now create a pivot table for this with the year on the left and the quarter on the top.

Create 2 calculated items on the year column

The first one (Actuals) as $2 and the second one as $2-$1 (growth) and then hide the details andthis would give the sales amt for all the quarters for the current year and the growth.