Tuesday, February 23, 2010

Excel and Oracle OLAP - Reporting No-Agg Measures

I've run into this a few times recently, so here's a quick tip related to using Excel with Oracle OLAP (via the Simba MDX Provider for Oracle OLAP, of course).

Here's a situation that's been reported as a bug, but you really just need to know the right Excel Pivot Table option to choose. Consider a cube that has measures that do not aggregate but is dimensioned by a dimension with a hierarchy. In this case, there is a cube with a Store dimension with levels Store > Store Type > All Stores. The stores are located in different countries and sell in local currencies. There is a Local Currency measure, with sales reported in whatever the local currencies might be (Euros, Dollars, Yen, etc.) and a Dollar Sales measure with the U.S. Dollar conversation. As a common currency, Dollars can be aggregated. Local currencies can't be aggregated.

Here's a sample report in Excel.



Note that Dollar Sales is reported for Direct and Indirect but Local Sales is not. That's correct because Local Sales doesn't aggregate.

But what if I happen to select only Local Sales (which is null at the aggregate members Direct and Indirect). By default, Excel will display the report as shown below.



This isn't very useful because I can't drill down on the Direct member to get at the stores. The solution is simple, but a lot of people seem to miss it. Just choose the Show items with no data in rows PivotTable option.



Now you will be able to see the Direct and Indirect members, allowing you to drill to stores.



Now, after the drill.

Thursday, February 11, 2010

Oracle Exadata: A Single Source of Truth (New Video)

Over the last 6-9 months we have been releasing a series of videos on YouTube under the banner of "DBA2.0" (a quick search on YouTube will list all these videos). These videos follow the work of a dedicated team of DBAs and business users as they try to get their jobs done in an environment that just keeps throwing up new challenges. Fortunately, Oracle is there to save the day...

This latest scenario deals with data warehousing and specifically Exadata. It is in two parts and the first installment has just been released - "Oracle Exadata: A Single Source of Truth". Here is the story so far:

A stroll through the halls of your IT department may reveal that there is no love lost between the DBAs and business analysts they support. In today's hyper competitive environment, business analysts need to perform more and more predictive analytics and they want the answers yesterday, but managing separate BI and OLAP servers and ensuring fast query performance can be a challenge for DBAs.

Watch this short video to see how the dynamic DBA duo address this challenge using Oracle Exadata, forging a truce with their new business analyst and even getting her to crack a smile - sort of.



Enjoy this video at http://www.youtube.com/watch?v=WgVSu-4Mizs and stay tuned for Part 2 which will be available shortly...

(Please Note: No DBAs or Business Analysts were harmed in the making of these videos)

Wednesday, February 10, 2010

Using MindMapping to view OLAP hierarchies...

I came across this interesting article by accident. One thing I have always wanted within AWM is a way of viewing a hierarchy or series of hierarchies. In the old days of Express I wrote a various Express programs, EIS code (who remembers Express EIS?), Express Objects extensions, that would list out a hierarchy. However, this article by Robert Brooke takes this idea way beyond anything I have seen because it uses the open source tool called MindMapping. Take a look at the series of articles Robert has written:

Now I am thinking if we could just add the MindMapping GUI into AWM and somehow allow people to build a hierarchy visually using the MindMapping GUI that would be something. This would give AWM a very powerful way of designing a hierarchy in a live/interactive manner. One for the OLAP PM team - I think. In the short-term I think it might be possible to use the AWM extension API to add the MindMapping GUI to AWM menus but this would simply launch an the MindMapping tools outside of AWM but that might be sufficient for the moment?

Nice one Robert!

Wednesday, November 4, 2009

Creating Cubes with Simple SQL

If you didn't look carefully at some of the Oracle OLAP 11.2 collateral there's a very interesting new feature that you've probably missed, the ability to create Oracle cubes and dimensions using only SQL. This feature is implemented at the CREATE_MVIEW program in the DBMS_CUBE package.

Here's how it works. You define SQL dimension objects and a table-based materialized view and then run the DBMS_CUBE.CREATE_MVIEW program. This program will (1) create an analytic workspace, (2) create OLAP dimensions from the SQL dimensions, (3) create a cube from the table-based materialized view and (4) create a cube-organized materialized view on the cube to enable query rewrite into the cube.

This feature is primarily designed to make it very easy to use the cube as a summary management solution for applications that query relational tables. For example, you might have an Oracle Business Intelligence (or Business Objects, Cognos or MicroStrategy) application that queries tables. If the application queries summary level data, can benefit from a performance boost and queries tables that tables represent data that is dimensional in nature (e.g., a star or snowflake schema), a cube is a great way to manage that summary data.

Let's look at a scenario. There's a star schema with time, product, customer and channel dimension tables and a sales fact table. The hierarchies are as follows:

Time: Day > Month > Quarter > Year
Product: Item > Subtype > Type > Category > Department
Customer: Customer > City > State > Country > Region
Channel: Channel > Class

The fact table contains data at the Day, Item, Customer and Channel levels for measures Sales and Quantity.

The objective is to create a cube and cube-organized materialized view that manages all summary data beginning at Month, Item, City and Channel levels. Note that in this example the detail of the cube will be a summary of the fact table.

Step 1 is to create SQL dimension objects for each of the dimension tables. (If you want to try this script yourself, download and install the OLAPTRAIN schema from the OLAP page on OTN. http://www.oracle.com/technology/products/bi/olap/11g/samples/schemas/readme.html .)

--
-- Create SQL dimension objects for hierarchies and attributes. The cube will
-- use these as the source definitions for cube.
--
-- Time dimension.
--
CREATE DIMENSION times
LEVEL day IS (times.day_key)
LEVEL month IS (times.month_id)
LEVEL calendar_quarter IS (times.calendar_quarter_id)
LEVEL calendar_year IS (times.calendar_year_id)
HIERARCHY calendar (
day CHILD OF
month CHILD OF
calendar_quarter CHILD OF
calendar_year)
ATTRIBUTE day DETERMINES (day_description)
ATTRIBUTE month DETERMINES (month_name, month_end_date)
ATTRIBUTE calendar_quarter DETERMINES (calendar_quarter_name, calendar_quarter_end_date)
ATTRIBUTE calendar_year DETERMINES (calendar_year_name, calendar_year_end_date);
--
-- Product dimension.
--
CREATE DIMENSION products
LEVEL item IS (products.item_key)
LEVEL subtype IS (products.subtype_key)
LEVEL type IS (products.type_key)
LEVEL category IS (products.category_key)
LEVEL department IS (products.department_key)
HIERARCHY departments (
item CHILD OF
subtype CHILD OF
type CHILD OF
category CHILD OF
department)
ATTRIBUTE item DETERMINES (item_name)
ATTRIBUTE subtype DETERMINES (subtype_name)
ATTRIBUTE type DETERMINES (type_name)
ATTRIBUTE category DETERMINES (category_name)
ATTRIBUTE department DETERMINES (department_name);
--
-- Customer dimension.
--
CREATE DIMENSION customers
LEVEL customer IS (customers.customer_key)
LEVEL city IS (customers.city_key)
LEVEL state IS (customers.state_province_key)
LEVEL country IS (customers.country_key)
LEVEL region IS (customers.region_key)
HIERARCHY regions (
customer CHILD OF
city CHILD OF
state CHILD OF
country CHILD OF
region)
ATTRIBUTE customer DETERMINES (customers.customer_number)
ATTRIBUTE city DETERMINES (customers.city_name)
ATTRIBUTE state DETERMINES (customers.state_province_name)
ATTRIBUTE country DETERMINES (customers.country_name)
ATTRIBUTE region DETERMINES (customers.region_name);
--
-- Channel dimension.
--
CREATE DIMENSION channels
LEVEL channel IS (channels.channel_key)
LEVEL class IS (channels.class_key)
HIERARCHY classes (
channel CHILD OF
class)
ATTRIBUTE channel DETERMINES (channels.channel_name)
ATTRIBUTE class DETERMINES (channels.class_name);

The next step is to create a table-based materialized view that summarizes data to the level you want to load into the cube. Note that you do not need load data into this materialized view (use the BUILD DEFERRED option). The DBMS_CUBE.CREATE_MVIEW program will simply use the table-based MV to understand how to query the source fact table and to find to the measures to be added to the cube.

--
-- Create the table-based materialized view. In this example, the table-based
-- materialized view aggregates data from the day to month levels in time
-- and the customer to city levels in customer.
--
-- MV is build deferred because the cube doesn't need data from the MV (it just
-- uses the MV's definition.
--
CREATE materialized VIEW sales_mon_ite_cit_cha_mv build deferred
AS
SELECT t.month_name,
p.item_name,
cu.city_name,
ch.channel_name,
SUM(f.sales) sales,
SUM(f.quantity) quantity
FROM times t,
products p,
customers cu,
channels ch,
sales_fact f
WHERE t.day_key = f.day_key
AND p.item_key = f.product
AND cu.customer_key = f.customer
AND ch.channel_key = f.channel
GROUP BY t.month_name,
p.item_name,
cu.city_name,
ch.channel_name;

Finally, run the DBMS_CUBE.CREATE_MVIEW program.

--
-- Create and load the cube-organized materialized view.
--
declare
myCubeMv varchar2(32);
begin
myCubeMv :=
dbms_cube.create_mview(
mvOwner =>user,
mvName =>'sales_mon_ite_cit_cha_mv',
sam_parameters=>'logDest=serverout,build=immediate' );
end;
/

There's several parameters to this program, but I found the defaults to be very reasonable. It built my cube as compressed, partitioned by quarter and pre-aggregation settings of 0 for the top partition and 35 for the bottom partition. You can control any of these settings with the sam_parameters argument. You can also defer the loading of the cube and load the cube later with the DBMS_CUBE.BUILD or DBMS_MVIEW.REFRESH programs.

The cube can be viewed and edited in Analytic Workspace Manager, so you can use it to check the design or make changes such as adding custom measures.

As with any other materialized view, you will need to make sure all the necessary constraints are in place on the base tables. I used AWM’s Relational Access Advisor feature (in the Cube / Materialized View tab) to generate constraint recommendations.

Thursday, April 30, 2009

Automatically Create Oracle Business Intelligence Repositories for Oracle11g Cubes

An OBIEE Plug-in for Oracle11g OLAP was released on the OLAP Option page on the Oracle Technical Network today. The plug-in allows you to automatically create OBIEE repositories that can be used to query Oracle11g cubes. It's really, really easy. The OBIEE repository created by the plug-in allows OBIEE to query all content of the cube, including summary data and advanced calculations. This is a great way to demonstrate how the Oracle cube can enhance the performance and analytic content of Oracle Business Intelligence Enterprise Edition.

The OBIEE Plug-in is used with Analytic Workspace Manager (AWM), the administrative tool of the Oracle OLAP Option. Only the most basic understanding of the OBIEE repository is required to use this AWM plug-in. The plug-in creates fully configured a physical database, business model and mapping layer and presentation catalog in the OBIEE repository.

Here are some useful links:

The Oracle OLAP OTN page.
The OBIEE Plug-in instruction sheet.
A demonstration video.
Download the plug-in.

Tuesday, April 7, 2009

Call for OpenWorld 2009 papers has started...

This years Oracle OpenWorld conference will be held on October 11-15 at the Moscone Center in San Francisco. A few days ago the OpenWorld website opened for customers and partners to submit proposals for presentations to be included in this years conference. This year there will be more sessions allocated to customer and partner papers which increases your chances of having your paper selected. The OpenWorld conference is a great opportunity to present your ideas to the Oracle Community and to add to increase your own knowledge by attending other presentations. Most importantly,all the Oracle OLAP Blog team will be onsite at the demo grounds so come and say "Hi" and checkout the latest cool 11g OLAP demos.

Presenting at OpenWorld is an amazing experience and I would recommend it to anyone and everyone. There is nothing quite like it. The deadline for submission is April 19 so act fast!

Are there any benefits to presenting? Of course - but the benefits/goody bags change every year and I am not sure what we will be offering this year. Obviously you get a complimentary Oracle OpenWorld Full Conference pass which means you can get into the vast majority of events during the conference. You get access to the whole presentation catalog via the OpenWorld website. On top of the Oracle goodies, most of the vendors in the demo grounds hand out lots of other goodies (it pays to bring an extra suitcase) and most evenings someone, somewhere, is usually offering free beer. What more could you ask for!

What should I present on? The topic is completely up to you. You can talk about a recent project or a specific database feature and how you used it. Just pick any topic you think will be of use and interest to other people.

The 2009 Conference web page is here. Look for the red link "Now Live" and good luck.

Thursday, April 2, 2009

Excel Update - Beta Version of MDX Provider Now Available

A quick update on using Excel to query an Oracle11g cube ....

Yesterday Simba announced availability beta 1 MDX provider for Oracle OLAP. I've been using prerelease version of the provider for a few months now and have been very happy with it. There's still some features to be added and some performance work to be done, but I think the beta 1 version is well worth trying. In my experience, the MDX provider is pretty stable and I very much like Excel as a front end to Oracle cubes.

To sign up, visit the MDX Provider for Oracle page at http://simba.com/MDX-Provider-for-Oracle-OLAP.htm . You can also find a video demo on this page.