Page tree
Skip to end of metadata
Go to start of metadata

With the release of the Extensible Analytics Engine, GoodData has improved on existing capabilities in developing ranking metrics.

GoodData’s ranking functionality has been improved with the following new features:

  • Ranking functions for use within MAQL metric definitions
  • Dense rankings
  • Percentage ranks
  • Cumulative distribution
  • Ranking within report sub-groups

RANK Function

You can apply a RANK function to any GoodData metric using MAQL in the Custom Metric Editor. Suppose you are using one of the basic metrics in a GoodData Sales Analytics project: Avg. Won. This metric represents the average size of a won opportunity.

The report below uses the Avg. Won metric and slices it by a Quarter/Year (Snapshot) attribute.

Original single-metric report


For simplicity’s sake we’ve filtered for the years 2011 and 2012, to limit our results to just eight rows of data.

Now suppose you want to rank all the results of the Avg. Won metric on the level of Quarter/Year. To do so, we’d add a second metric to the report:

What tab:

SELECT RANK(Avg. Won)


Below, the results display ranking for all rows from smallest to largest values. By default, ranking is carried out in ascending order (keyword ASC), but you can also specify descending order ranking by adding the DESC keyword after the metric specification:

SELECT RANK(Avg. Won) DESC

Report with a ranking metric added


If you were to change the report granularity to month/year, the ranking function would rank the new results accordingly – adapting to the new granularity of hte report.

WITHIN Statement

However, if you want to rank the metric results within subgroups in the report, such as by Year, while continuing to view data at the Quarter/Year dimensionality, we’ll need to add a WITHIN(Year) statement to our metric definition. Our new metric would take the following form:

SELECT RANK(Avg. Won) WITHIN (Year (Snapshot))

Ranking within report subgroups


For more on RANK function syntax, including additional variations of the WITHIN statement, see our article Introducing the Extensible Analytics Engine.

And as always, for a comprehensive overview of MAQL, see MAQL - Multi-Dimension Analytical Query Language.