Hierarchize in MDX can be used for reordering Members in a set in hierarchical fashion.
To be more clear, Its have a look at below Query.
SELECT
Hierarchize
(
{
[Date].[Calendar].[Calendar Semester].&[2010]&[1]
,[Date].[Calendar].[Month].&[2010]&[6]
,[Date].[Calendar].[Month].&[2010]&[9]
,[Date].[Calendar].[Calendar Year].&[2010]
,[Date].[Calendar].[Month].&[2010]&[11]
}
) ON 0
FROM [Adventure Works]
To be more clear, Its have a look at below Query.
- Query below is having a set which start with Semister 1 of 2010 followed by June 2010 and September 2010 which are followed by Year 2010 & .
- So, Clearly this is not an expected order and this should be as follows, Year 2010, Semister 1 2010, June 2010, September 2010 and Nov 2010.
- This can be achieved by passing this SET through Hierarchize function as shown in screen below.
SELECT
Hierarchize
(
{
[Date].[Calendar].[Calendar Semester].&[2010]&[1]
,[Date].[Calendar].[Month].&[2010]&[6]
,[Date].[Calendar].[Month].&[2010]&[9]
,[Date].[Calendar].[Calendar Year].&[2010]
,[Date].[Calendar].[Month].&[2010]&[11]
}
) ON 0
FROM [Adventure Works]
- Same Query without Hierarchize would have resulted in unordered resultset as shown below.
- SELECT Hierarchize
(
{
[Date].[Calendar].[Calendar Semester].&[2010]&[1]
,[Date].[Calendar].[Month].&[2010]&[6]
,[Date].[Calendar].[Month].&[2010]&[9]
,[Date].[Calendar].[Calendar Year].&[2010]
,[Date].[Calendar].[Month].&[2010]&[11]
}
) ON 0
FROM [Adventure Works
No comments:
Post a Comment