Modifying the Instaview model

As you have probably noticed, Pentaho Instaview automatically generates, based on our data, a metadata model. However, the end result in the analysis-reporting tool isn't easy to understand as the dimensions and measures have technical names. This recipe guides us through editing the metadata model.

Getting ready

To get ready for this recipe, you first need to start Instaview with the MongoDB Orders data source created and modified in previous recipes, and the MongoDB server with the same database as that of the last chapter.

How to do it…

Perform the following steps to edit the Instaview model:

  1. In the Instaview home, click on the Open Existing button.
  2. Select MongoDB Orders from the Data Sources list and click on OK.
  3. Click on the Configure tab.
  4. Next, click on the Edit link of the Model section. Accept the alert about model editing, by clicking on the OK button. You'll be redirected to the Model Editor perspective, as shown in the following screenshot:
    How to do it…
  5. Remove the measures that don't make sense in the model. Select the Customernumber field and click on the red square button with the white X on the top. Do the same for the following fields: Orderlinenumber, Ordermonthdate, Ordernumber, and Orderyeardate.
  6. Rename the measures to appropriate names. Select Priceeach and in the properties in the right-hand side, change Display Name to Price Each. Do the same for the following measures: Quantityordered to Quantity Ordered and Totalprice to Total Price.
  7. Remove the dimensions that they are measuring in the model. Select the Priceeach field and click on the red button with the white X. Do the same for the following dimensions: Quantityordered and Totalprice.
  8. Define the hierarchy of Order Date as follows:
    1. In the Dimensions tree expand the full tree of Orderdate, Orderyeardate, and Ordermonthdate.
    2. Drag the Orderyeardate level that has a yellow icon and drop it between the Orderdate hierarchy and the Orderdate level.
    3. Drag the Ordermonthdate level and drop between Orderyeardate and Orderdate levels. You should get the structure as shown in the following screenshot:
      How to do it…
    4. Remove the useless dimensions, such as Ordermonthdate and Orderyeardate; they have a yellow exclamation icon.
  9. Rename the dimension, hierarchies and levels as seen in the following screenshot:
    How to do it…
  10. Define the dimension time by performing the following set of steps:
    1. Select the Order Date dimension and check the Time Dimension property.
    2. Then, select the Year level and the Years option of Time Level Type.
    3. Select the Month level and the Months option of Time Level Type.
    4. Next, select the Date level and the Days option of Time Level Type.
    5. Select the Required Date dimension and check the Time Dimension property.
    6. Then, select the Required Date level and the Days option of Time Level Type.
    7. Select the Shipped Date dimension and check the Time Dimension property.
    8. Finally, select the Shipped Date level and the Days option of Time Level Type.
  11. Save the analysis model by clicking on the Save button or by pressing Ctrl + S.
  12. Change to the Instaview perspective.
  13. Click on the Run button.
  14. After the execution, you'll see new, and better, names for exploring your data. Drag and drop the Year and Month levels into the Rows area. Then, drag and drop the Status level into the Columns area. Finally, drag and drop the Total Price measure into the Measures area. You should get a report like this:
    How to do it…

How it works…

In this recipe, we started by removing the measures that don't make sense existing. Basically, Pentaho Instaview defines any numeric column as a measure and all columns as dimensions. After this change, we rename the measure to be accurate with the data that we will analyze.

After we have clarified the measures (as we did the same for dimensions), we will start by removing dimensions that aren't necessary.

As with any OLAP solution, the date dimension is common. That's why we define the date dimension with the right hierarchy of years, months, and days.

Finally, we rename all dimensions and sub-attributes (hierarchies and levels). The end result is that the exploration data is clearer to understand.

See also

In Chapter 4, A MongoDB OLAP Schema, you can find out how to create a Mondrian schema.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset