Jump to content
JasperReports Library 7.0 is now available ×
  • This documentation is an older version of Jaspersoft OLAP Ultimate Guide. View the latest documentation.

    By following these processes, you define a model that describes your data in terms of dimensional analysis.

    Example Using FoodMart Data

    This example is based on the FoodMart sample data that can be installed with JasperReports Server. It illustrates the types of questions that can be answered interactively using Jaspersoft OLAP. Our goal in this section is to answer this question: what type of alcoholic beverage generates the most revenue?

    Each step in this example shows the corresponding MDX query so that you can explore the data on your own.

    To analyze the FoodMart view:

    1. We’ll begin by looking at a top-level summary of sales for all products. An aggregated view like this lets us dive into the data in any direction of interest. In this example, we look at data for the month of December.

    ja-ug-admin-toplevelsummary_147x72.png.cd3e0362158114e864a972cd44f961f4.png

    Top-level Summary for December

    select {[Measures].[store Sales]} ON COLUMNS,

    Hierarchize({[Product].[All Products]}) ON ROWS

    from [sales]

    2. Drill-down is the most basic function in analysis.

    To drill-down, click ja-expand-position-nav-table_14x14.jpg.bff285bb048cd6f16689719b657c1957.jpg next to the ALL PRODUCTS member; the next level of the PRODUCT hierarchy, Product Family, appears.

    ja-ug-admin-drilldown1_222x129.png.ee3f7f0031bfed39993eb1f764cbdd57.png

    Expand All Products

    select {[Measures].[store Sales]} ON COLUMNS,

    Hierarchize(Union({[Product].[All Products]}, [Product].[All Products].Children)) ON ROWS

    from [sales]

    where [Time].[2012].[Q4].[12]

    3. Drill-down again, this time by zooming on the Drink product family. Use ja-pro-zoom-on-drill.png.4c45e52dd575775d8887e17280d9fd97.png
    Select ja-pro-change-data-cube.png.f792e424148fee42c5633c60868a7b4d.png, make STORE a row, and select All Stores> USA > CA (for instructions on adding a dimension, refer to Cube Configuration

    ja-ug-admin-drilldown2_310x110.png.fed9eaaf7ca3a8cdf6a8bda17f45c98c.png

    Zoom on the Drink Product Family

    select {[Measures].[store Sales]} ON COLUMNS,

    [Product].[Drink].Children ON ROWS

    from [sales]

    where [Time].[2012].[Q4].[12]

    4. By zooming, we could drill-down to the lowest level of data in the cube. Let’s instead focus our attention by zooming on the ALCOHOLIC BEVERAGES product department, then the BEER AND WINE product category.

    ja-ug-admin-expand1_484x90.png.99e54bab08c32cb6fe42d6121fefcc9b.png

    Expand Beer and Wine Subcategories

    select {[Measures].[store Sales]} ON COLUMNS,

    [Product].[Drink].[Alcoholic Beverages].[beer and Wine].Children ON ROWS

    from [sales]

    where [Time].[2012].[Q4].[12]

    Now we can see that, overall, wine makes up the majority of the dollar amount for this category.

    5. Let’s see if that finding holds true across different stores. To do so, we add another dimension, which creates a crossjoin. Analytic views make creating a crossjoin easy.
    a. ). Adding the STORE dimension to rows allows you to see the breakdown within the store as well as across different stores with respect to certain products (if we wanted to compare different products across stores, we would make PRODUCTS a row instead of STORES).

    ja-ug-admin-expand2_541x92.png.232aeb5c7b62fa6f202df59efe00e778.png

    Adding the All Stores Dimension

    select {[Measures].[store Sales]} ON COLUMNS,

    Crossjoin([Product].[Drink].[Alcoholic Beverages].[beer and Wine].Children, {[store].[All Stores]}) ON ROWS

    from [sales]

    where [Time].[2012].[Q4].[12]

    b. Deselect the ja-pro-zoom-on-drill.png.71bff1ed5079b1383fc05207ce3fbdb8.png

    ja-ug-admin-drilldown3_552x182.png.fa089af5cbdae0a16315eeaccf1e02e4.png

    Stores in California

    select {[Measures].[store Sales]} ON COLUMNS,

    Crossjoin([Product].[Drink].[Alcoholic Beverages].[beer and Wine].Children, [store].[uSA].[CA].Children) ON ROWS

    from [sales]

    where [Time].[2012].[Q4].[12]

    With Jaspersoft OLAP, the data can be “sliced and diced” in many ways, allowing you to focus the viewer’s attention on the most relevant data. There are usually several ways to view the same data. The previous steps showed some of these ways. We could also make the STORE dimension a column; this might be a good approach when you have many different products to compare. Doing so results in a two-by-five grid, with the single-dimension layout becoming a two-dimension layout.

    ja-ug-admin-storesascolumns_552x123.png.ed42eb4e7ac7e75147ae7a6d97c782e6.png

    Stores as Columns Instead of Rows

    select Crossjoin({[Measures].[store Sales]}, [store].[uSA].[CA].Children) ON COLUMNS,

    [Product].[Drink].[Alcoholic Beverages].[beer and Wine].Children ON ROWS

    from [sales]

    where [Time].[2012].[Q4].[12]

    For another example, let’s make the table easier to understand by switching the rows and columns. This is called “pivoting,” that is, we are rotating this section of the cube. Pivoting gives us a five-by-two grid of data cells, which is often easier to read online and is better suited to printing on U.S. Letter-sized paper. While the previous example compares product subcategories by store, swapping the columns and rows lets us compare each store’s results by product.

    ja-ug-admin-pivoting_414x217.png.fc49aff502db2efa5b6b5267de15b9a1.png

    Pivoting the View

    We now see that the San Francisco store sold a fraction of the alcoholic beverages that other California stores sold, and that it sold no beer at all.

    Leveraging the Ad Hoc Editor

    The model we defined in Designing the Model and implemented in Applying the Model can also be leveraged by the Ad Hoc Editor. Select the sample FoodMart Mondrian connection as your data source when you open the editor; then slice, dice, and drill in the same manner as we’ve done in Jaspersoft OLAP. The resulting Ad Hoc view can be saved as a report which in turn can be scheduled for email distribution and incorporated into dashboards. “FoodMart Sales data in an Ad Hoc View” shows an Ad Hoc view of the same data as shown in the OLAP view in “Pivoting the View”.

    js-adhoc-ca-beer-wine-view-simple_420x198.png.ff39ee1ff44217fb58c25cb0c9b7bb1e.png

    FoodMart Sales data in an Ad Hoc View

    In the course of this example, we have unearthed questions we hadn’t thought to ask previously: is the lack of beer sales part of a trend in this store’s overall beverage sales? We can answer other questions, such as whether the store’s overall sales lag across all products, or whether another product’s sales make up for the lack of beer sales.

    Alternately, we could look at the best performing stores in each category or product to try to understand the secrets to their success. Ranking and sorting can be very helpful in this type of analysis when comparing many values. Your MDX statements can include any imaginable statistical functions. For example, you could include arbitrarily-complex expressions to show the top or bottom percent of any measure.

    select [Product].[All Products].[Drink].[Alcoholic Beverages].[beer and Wine].Children ON COLUMNS,

    Crossjoin([store].[All Stores].[uSA].[CA].Children, {[Measures].[store Sales]}) ON ROWS

    from [sales]

    where [Time].[2012].[Q4].[12]

    We can show analysis data as a graphical chart, just as might be defined in a report. This chart shows the same data as the sample above, but in a vertical 3D bar chart:

    ja-ug-admin-chart.png.114bf0f617dba1af8ecf189baca273a1.png

    Chart of Beer and Wine Sales in California

    The chart focuses on aggregated data, that is, the totals for all the sales at any dimensional coordinates. This is not to imply that analysis supplants transactional reporting. Analysis provides transactional reporting on demand by showing your data in different contexts and different levels of roll-up.

    Examining the basic row data is still very helpful in furthering your understanding of a particular area. For example, in the table, use ja-pro-zoom-on-drill.png.65fad5a7d1e6a94cac64f25a2b240a35.png to drill-through to the wine sales for San Francisco to show detailed transactional information. We’re looking at individual rows of data to understand this one store’s wine sales in December of 2012 (table is truncated).

    ja-ug-admin-drillthrough_598x158.png.6bd3a2a471c003eb17640c79a830abf7.png

    Drill-through Table of San Francisco Beer And Wine Sales


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...