02 August, 2008

MDX in Mondrian


MDX (Multidimensional Expression) is a language construct to query OLAP cubes. It is much like SQL is a language construct to query relational database.

MDX was an initiative of Microsoft as part of the OLE DB for OLAP (ODBO) specification in 1997. Mosha Pasumansky is one of the architects of the language. MDX was soon implemented by many OLAP vendors as their standard OLAP query language including Mondrian.

With MDX you can query a selection of Online Analytical Processing (OLAP) data, doing some calculations, and retrieving meta data properties.

Example of simple MDX query is shown below :
select {[Measures].[Unit Sales]} ON COLUMNS,
{[Product].[All Products]} ON ROWS
from [Sales]
where [Time].[1997]

This will query from "Sales" cube a "Unit Sales" measure value from "All Products" dimension that happened in 1997. You can try it against Foodmart sample database.

Mondrian has implemented many of standard MDX expressions supported in MS Analysis Server. You can find a detailed of the expression here.

MDX entry in Mondrian JPivot's Sample

You can type your MDX query in JPivot JSP page in two ways :
  • Type it under jp:mondrianQuery tag
  • Type it under MDX editor

Using MDX Editor
  • Start your Mondrian OLAP server
  • Browse to one of your sample JSP file, for example "JPivot pivot table"
  • Click on MDX button in the above page toolbar, it will show up an MDX Editor
  • Type the previous sample MDX query here, and click Apply button

  • You will now have a new slice and dice table view of that MDX query

More Resources

Check on the following web resources for more information about MDX :

1 comment:

Unknown said...

I want to hide some buttons on the toolbar... is this posible?