Wednesday, April 30, 2008

SSRS 2005 : How to create a dataset of member from an OLAP database

Requirements:
Having a knowledge of MDX

Having a knowledge of SSRS (being able to create a report, a datasource and a report parameter)

Having an OLAP database with at least one cube and one dimension

Creating the dataset
  • Name = your dataset name
  • Datasource = your OLAP datasource
  • Command type = Text
  • Query string =


WITH
MEMBER [MEASURES].[ParameterValue]
AS Axis(1).Item(0).Item(0).Dimension.CurrentMember.UNIQUE_NAME


MEMBER [MEASURES].[ParameterCaption]
AS String( Axis(1).Item(0).Item(0).Dimension.CurrentMember.Level.Ordinal * 1 , ' ' ) + Axis(1).Item(0).Item(0).Dimension.CurrentMember.Member_Caption


--the 5 last members
Set [theSet] as Order( Tail( [DimensionName].[HierarchyName].Members, 5), [DimensionName].[HierarchyName].CurrentMember.UniqueName, Asc)


SELECT
{ [ParameterCaption]
, [ParameterValue]
} ON COLUMNS
, Non Empty [theSet]
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME on ROWS
from [CubeName]

  • Click on the OK button to validate

To use this list of member, you have to create a new Report Parameters.

You can use the following picture as example

Good Luck!

No comments: