OLAP Rank Use Cases

Example 1:

Determine the top year for all countries. This is accomplished by applying a rank step for the dataItem – Year and passing in the value of 1. For TopCount, it is not necessary to include a measure into the step, because TopCount is based on the measured that been defined in the query

> MDX Generated:

> Sample Code to use:

> > int val = 1;

> Integer vall = new Integer(val);

> Object value = (Object) vall;

> DataItemRankFilter step = new DataItemRankFilter(DataItemRankFilter.TOP, value);

> dataItem.addStep(step); <<== where dataitem is YEAR dimension

Example 2:

Determine those products that make up 50 percent of Actual Sales. This is accomplished by applying a rank step to dataitem - "product" and passing in 50 as value with [actual_sum] as ranking value.

> MDX Generated:

> Sample Code to use:

> > int val = 50;

> > Integer vall = new Integer(val);

> > Object value = (Object) vall;

> > List byRank = new ArrayList();

> > byRank.add(measureDataItem);<<== where measureDataItem is [Measures].[ACTUAL_SUM]

> > DataItemRankFilter step = new DataItemRankFilter(DataItemRankFilter.TOP, value, byRank , DataItemRankFilter.PERCENT);

> > dataItem.addStep(step); <<== where dataitem is PRODUCT dimension