A national Wireless Carrier requires a dashboard for tracking telecommunications traffic, with filters for Source Region, Destination Region, and Month (currently set to January), allowing for detailed analysis of calling patterns and platform usage.
Before we begin our dashboard journey, we need to understand our OLAP Mondrian datasource.
Log into the Postgres baseline_demo database.
The baseline_demo database has a number of key features:
• Centralized Fact Tables
• Dimension Tables (sometimes called lookup tables)
• Simple Join Paths
• Denormalized Structure
• Query Optimization Features
These tables have been 'mapped' using Pentaho Schema Workbench.
You will need to copy over the Postgres database driver to: /schema-workbench/lib
Start Schema Workbench.
cd
cd /Pentaho/design-tools/schema-workbench
./workbench.sh
You can test your MDX queries that will be used to populate the dashboard.
Open the MDX query panel: File -> New -> MDX Query
Copy & paste the following MDX query. Execute.
WITH
MEMBER [Measures].[Source Member Name] AS [Call Source].currentmember.uniquename
SELECT
[Measures].[Source Member Name] ON 0,
{[Call Source].[All], [Call Source].[Source Region].Members} ON 1
FROM
[Call Corridor]
The last step is to from the Pentaho Server - PUC
• define a connection to the baseline_demo databse
• upload the Wireless carrier Mondrian Schema
In the PUC select: Manage Data Sources.
Click on the cog wheel & select: New Connection.
Select Postgres and enter the following details:
The Manage Data Sources also has the option to: Import Analysis
Browse to: Workshop--CTools/schemas/Wireless Carrier.Mondian.xml and associate with baseline_demo datasource.
Click: Import & check the xml schema has been successfully imported.
The schema can now be referenced to create the dashboard mdx.mondrian.jndi queries.
We're going to make a few assumptions here ..
• connections tested
• the layout has been confirmed
• chart content & types agreed
• dashboard functions included - export graphs & tables
There are five “main” rows:
The first row contains four columns: one with the logo, and three with the selectors.
The second row contains two columns with the main KPIs: Number of Calls and Average Call Duration. Each column contains two rows: one for the header, and another for the data.
The third row has two columns, each with two rows.
The fourth and fifth rows have one column which contains two rows, but notice that the first row is split into two columns because there is a title and an Export button.
Now that the Layout is complete, time to turn our attention to CDA data sources.
All the data in this dashboard comes from ten MDX queries.
The three selectors:
• Source Region
• Destination Region
• Month
are all populated via MDX queries, as are each of the tables and charts in the dashboard.
We're going to add two MDX queries to the dashboard.
• First query returns the values for the Source Selector.
• Second query returns the results for the main dashboard table that includes several defined parameters.
Let's start with the MDX query that retrieves the list of Regions.
Start with the Layout dashboard ..
Layout
Browse to: /Public/CTools Dashboard/Carrier-Dashboard-CDA/Layout
Click Edit under File Actions.
On the CDE Perspectives Toolbar, click the Data Sources Panel icon.
From the Data Source list, expand MDX Queries, and then click mdx over mondrianjndi.
To name this data source, in the Properties pane:
• Click in the Value for the Name property.
• Type sourceSelectorQuery.
• Press Tab or Enter.
Its BP to add the suffix “Query” to the data source name.
In the Properties pane:
• Click in the Value for the Jndi property.
• On the keyboard, press the down arrow.
• Select the BaselineDemo connection.
In the Properties pane:
• Click in the Value for the Mondrian schema property.
• On the keyboard, press the down arrow.
• Select the Wireless Carrier schema.
To enter the MDX query:
• In the Properties pane, click the ellipsis icon to the right of the Query property.
• In the MDX Editor window, enter the following MDX query, and then click OK:
WITH
MEMBER [Measures].[Source Member Name] AS [Call Source].currentmember.uniquename
SELECT
[Measures].[Source Member Name] ON 0,
{[Call Source].[All], [Call Source].[Source Region].Members} ON 1
FROM
[Call Corridor]
The query creates a calculated member (Source Member Name) and obtains the list of Source Regions from the Call Source dimension.
Save & Test the Layout.cda
OOOOps the columns are the wrong way around ..
To change the order of the columns:
• In the Properties pane, click in the Value for the Output Columns property.
• In the new window, click the Add button once to add another field.
• In the first Index field, type 1.
• In the second Index field, type 0.
• Click OK.
Save the dashboard and try again .. Refresh the layout.cda
Notice the Query has also returned an 'Unknown' Geography value .. This indicates that the Geography table in the baseline_demo database contains errors.
Next MDX query populates the main dashboard table. This query is a bit trickier as it includes parameters ..
Duplicate the sourceSelectorQuery and change the name to tableQuery.
Delete the Output columns.
Add the MDX Query.
WITH
MEMBER [Measures].[usersCurrentMonth] AS '([Measures].[Users], ${monthParameter})'
MEMBER [Measures].[usersLastMonth] AS '([Measures].[Users], ${monthParameter}.Lag(1))'
MEMBER [Measures].[usersDifference] AS 'IIf(IsEmpty([Measures].[usersCurrentMonth]), NULL, (([Measures].[usersCurrentMonth] / [Measures].[usersLastMonth])-1)*100)'
MEMBER [Measures].[callsCurrentMonth] AS '([Measures].[Calls], ${monthParameter})'
MEMBER [Measures].[callsLastMonth] AS '([Measures].[Calls], ${monthParameter}.LAG(1))'
MEMBER [Measures].[callsDifference] AS 'IIf(IsEmpty([Measures].[callsCurrentMonth]), NULL, (([Measures].[callsCurrentMonth] / [Measures].[callsLastMonth])-1)*100)'
MEMBER [Measures].[timeCurrentMonth] AS '([Measures].[Duration in Minutes], ${monthParameter})'
MEMBER [Measures].[timeLastMonth] AS '([Measures].[Duration in Minutes],${monthParameter}.LAG(1))'
MEMBER [Measures].[timeDifference] AS 'IIf(IsEmpty([Measures].[timeCurrentMonth]), NULL, (([Measures].[timeCurrentMonth] / [Measures].[timeLastMonth])-1)*100)'
SELECT {[Measures].[usersCurrentMonth], [Measures].[usersDifference], [Measures].[callsCurrentMonth], [Measures].[callsDifference], [Measures].[timeCurrentMonth],[Measures].[timeDifference]} ON COLUMNS,
CROSSJOIN(${sourceCallParameter}${sourceChildren}, ${destinationCallParameter}${destinationChildren}) ON ROWS
FROM
[Call Corridor]
It's out of scope to explain how MDX queries work , however, let's break this Query down into the various parts to hep explain whats happening behind the scenes:
Calculated Members Definition: The query starts by defining several calculated members in three groups (users, calls, and time), each following the same pattern:
Users:
- [usersCurrentMonth]: Gets the Users measure for the current month (specified by monthParameter)
- [usersLastMonth]: Gets the Users measure for the previous month using LAG(1)
- [usersDifference]: Calculates the percentage change between current and last month ((current/last - 1) * 100)
Calls:
- [callsCurrentMonth]: Gets the Calls measure for current month
- [callsLastMonth]: Gets the Calls measure for previous month
- [callsDifference]: Calculates percentage change in calls
Duration:
- [timeCurrentMonth]: Gets Duration in Minutes for current month
- [timeLastMonth]: Gets Duration for previous month
- [timeDifference]: Calculates percentage change in duration
The IIf Logic: Each "difference" measure uses IIf(IsEmpty()) to handle null cases.
This prevents division by zero errors and returns NULL if current month data is empty.
${destinationChildren}: Additional destination hierarchy members
From Clause: The data comes from a cube named [Call Corridor], which tracks call metrics between different locations.
The query is designed to display month-over-month comparisons of:
• Number of users
• Number of calls
• Total call duration
Each with their corresponding percentage changes, broken down by source and destination locations.
To specify default values for the parameters:
• In the Properties pane, click in the Value column for the Parameters property.
• In the new window, click the Add button four times.
• In the Name and Value columns, type the following:
Parameter
MDX
destinationCallParameter
[Call Destination.Destination Geography].[All]
sourceCallParameter
[Call Source.Source Geography].[All]
monthParameter
[Time.Standard Time].[2011].[Q1 2011].[January]
sourceChildren
.Children
destinationChildren
.Children
.Children returns all the direct child members of a given member in a hierarchy. When used with crossjoined tables, it returns the immediate descendants of the specified level or member.
To see the new results in CDA:
• From the Opened perspective, click the layout.cda tab.
• Right-click the layout.cda tab.
• From the menu, select Reload Tab.
• In the Confirm Reload dialog, click Yes.
The column names and data formats are not ideal. We will improve the appearance of the data when we create the table later.
For now let's modify the column names for the tableQuery.
To specify column names for the query output:
• In the Properties pane, click in the Value column for the Columns property.
• In the new window, click the Add button seven times.
• In the Index and Name columns type the following, and then press OK.
Duplicate the tableQuery and rename to: lineChartQuery.
Replace the existing MDX query:
WITH
SET DAYS AS DESCENDANTS(${monthParameter}, 1)
SELECT
DAYS ON 1,
{[Measures].[Calls], [Measures].[Users]} ON 0
FROM
[Call Corridor]
WHERE
(${sourceCallParameter}, ${destinationCallParameter})
To edit/delete the column names:
• Click in the Value column for the Columns property.