Wednesday, October 23, 2013

OBIEE - Grouping measures and counting group members

Few days ago I was asked for something like this: "We have a table of Revenue for each Product. How can the end user assign the values of Revenue into groups he invents and then count the number of Products in each group." 
It seems easy but, try it in SQL. It's not trivial at all. 

For some reason I had a blackout. Since I reinvent the answer to similar questions for the third time at least; It's time to write about it here. The process actually takes about 3 minutes, but it will be a bit long post, since it's a very detailed explanation.

We start with the basic analysis: Product and the Revenue (twice). One Revenue column to work with and the other for QA.
 Next edit one of the Revenues formula and select "Bins". Here we can easily create groups, we could otherwise create by a big manual case statement.
I created a bin named "1. Under 100K" with condition of Revenue<100000.
It's important to uncheck the "Treat result as numeric value ..." since the result is textual.

otherwise you will get the following error:
I created few bins and then created the last one by marking "create a bin of all other values".
Since I want to use the result of the bins as attribute later (count the number of Products in each bin), I'll check the "Treat as an attribute column",at the bottom of the function screen.
I named the column "Bins".
In "results"Tab, we have a result table, I'll delete it and create a Pivot table.
Now it's time to edit the pivot:
I will switch the Products column and the Bins column in the Pivot Table:
 
First I'll move the Bins column to the left axis of the pivot:
Next move the Products column to the Measures section of the Pivot:
Of course the Product Names can't be aggregated and are left blank in the Result.
So it's time to click the Products column and select "Aggregation Rule" and "Count":
Now it's perfect.
If you prefer you can exclude the regular Revenue column or add a Chart:
This is the result:

Monday, October 21, 2013

OBIEE - Sorting the Pivot by Totals

I was requested to sort  a pivot table by a total column.
For example:

In my 11.1.1.7 I can easily sort on any of the year Revenue but no on the total.
My initial reaction was to create a calculation in criteria, something like sum("Base Facts"."Revenue" by "Products"."Product Type") and put it in the left axis. 
But I preferred a better solution.

I created a new calculated item:
Based on Time.Per name Year (the one I have in the top axis)

The calculation,  I named Total Revenue, is sum(*). With "custom formula" in function.

Now I can get rid of the original Total:
And have this:
I can sort by 2008, 2009, 2010, but unfortunately I still can't sort by Total Revenue!!??

To achieve that switch the measure location in the pivot.
Now I can sort the relevant Revenue:

And rearrange the top Axis if I desire that:

Rearrange using the Layout (see bellow) and not by direct dragging of the axis. For some reason, this option breaks the order by...

 

Sunday, October 20, 2013

OBIEE 11g Chrome 30+ problem, follow up

Lets start with the good news, I installed the patch 16068402 on my local Win7, OBIEE 11.1.1.7.1 and the chrome issue on my Chrome 30.0.1599.101 was solved.
I will have to double check with my customers or patiently wait for the next Patch bundle.

But I write this post not only to brag about my computer.

Since the above patch is relevant for 11.1.1.7.1 and the latest 11.1.1.6 bundle patches solve the issue there, I still have few 11.1.1.5.X customers that haven't upgraded yet (soon I hope).
One of them tried the advice of Nosferatu84 at http://productforums.google.com/forum/#!topic/chrome/X0uMqd7sE6E and says its working. (Didn't try it myself, but similar logic is described at Oracle support site). Please note it's absolutely not supported procedure.

So to summarize Nosferatu84 (I hope it's OK I copied the answer here):
It looks like Oracle found a solution, they haven't post it in the official blog but I tested in our DEV environment and it works.
At line 810 in Ajax.js there is the functioning code that allows Firefox to work: 
if (saw.userAgent.is_nav && d && this.submitMethod == "post") { 
e.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") } 

Proposed fix, add: 
if (saw.userAgent.is_webkit && d && this.submitMethod == "post") { 
e.setRequestHeader("Content-Type", "application/xml") }

You would need to redeploy the analytics.ear

When Nosferatu84 was asked how to redeploy the Analytics.ear, the answer was:
 The process is a little bit surgical...
(Please change the paths to your server conditions)
You need to modify the sources of the analytics.ear, you can find this file on:
.../Oracle_BI1/bifoundation/jee
Copy the ear file to some temp folder, and as usual make a backup of the original analytics.ear
- Uncompress the contents of analytics.ear
- Run the command: C:\tmp1> d:\Java\jdk1.6.0_29\bin\jar xvf analytics.ear
- Copy the analytics.war into another tmp folder
- Uncompress the .war file C:\tmp2> d:\Java\jdk1.6.0_29\bin\jar xvf analytics.war
- Now you will have the source of analytics, find in  c:\tmp2\res\b_mozilla\common
the file ajax.js, modify this file with the instructions on my first post.
- Now we need to compress everything back how it was before
- delete the current analytics.war from the folder tmp2
- Run C:\tmp2>d:\Java\jdk1.6.0_29\bin\jar cvf analytics.war *
- Copy the new generated analytics.war into the tmp1 folder
- In tmp1 folder remove delete the old analytics.ear
- Run C:\tmp2>d:\Java\jdk1.6.0_29\bin\jar cvf analytics.ear *
Almost done....
Copy the new generated .ear file again to .../Oracle_BI1\bifoundation\jee
In console delete the application and Redeploy... (or better replace the ear file and restart)

Sunday, October 13, 2013

OBIEE 11g Chrome 30+ problem, solution

Many of you probably noticed since last week, OBIEE mostly stopped working on Chrome, since it was automatically upgraded for most of us to version 30+ (30.0.1599.69 (Official Build 226629), to be 100% correct).
Oracle team at support solved the issue within few days. For 11.1.1.6 and 11.1.1.7 see:Update to OBIEE Chrome 30 issue.

Due to it's current support state (see Premier Support Product Life Cycle for OBIEE 11.1.1.5 ends March 2013, for example), I'm not aware of similar patch for 11.1.1.5.