BLOG

MDX LastPeriods Function

13-07-2019  0 Comment(s)

MDX LastPeriods function is used to navigate between same level members and returns the set of members up to the specified position including the given number itself. For example, If you want to list the members from one position to particular member then we can use this MDX LastPeriods function.

Member_Expression: Any Multidimensional Expression that returns valid Member.

Member_Position: Please specify the position of a member you want to Navigate.

  • If we use Zero as the Member_Position then LastPeriods Function will return the empty set.
  • If we use Negative Value as the Member_Position then LastPeriods Function will move forward to specified value and returns the set of members up to that position including the Member_Expression.
  • And, If we use Positive Value as the Member_Position then LastPeriods Function will move Backwards to specified value and returns the set of members up to that position including the Member_Expression.

In this article we will show you, How to write MDX LastPeriods function to navigate both forward and backward with examples. For this, we are going to use below shown data.

MDX LastPeriods Function with Zero

In this example we will show you, What happen when we use Zero value for the LastPeriods Function. The following query will return the Empty set

 

SELECT 
  [Measures].[Internet Sales Amount] ON COLUMNS,
  LASTPERIODS (
               3, 
              [Date].[Calendar].[Calendar Year].[CY 2013] 
	       ) ON ROWS
FROM [Adventure Works]

 

Comment Here

Comments

No Comments to Show

WE ALWAYS WORK WITH :