Navigating dimension hierarchies
Earlier in this chapter you learned how to use the CurrentMember
function to retrieve the name of the current hierarchy member. MDX allows browsing hierarchies easily using similar functions, PrevMember
and NextMember
, which are extremely useful for trend analysis. Additionally, you can obtain hierarchy members using relative functions, such as children, ancestors, descendants, and parent, to build sets based on the members of interest. This section will list examples where these functions are particularly beneficial.
How to do it...
Let's get started with navigating dimension hierarchies.
To implement the
[Year-over-Year Growth in Reseller Sales Amount]
calculated measure, open the sample Adventure Works 2012 database in SQL Server Data Tools (SSDT), navigate to Adventure Works cube's Calculations tab, and enter the expression that will follow. Note that we have two nested IIF functions. The first IIF function uses an ordinal function to determine whether we...