Tuesday, November 3, 2015

MDX PeriodsToDate Function



In Multidimensional Expression, PeriodsToDate Function is used to navigate between same level members and returns the set of sibling members from First Sibling to the specified member For example, If you want to list the members from one position to particular member then we can use this PeriodsToDate function.

MDX PeriodsToDate Function Syntax

The basic syntax of the MDX PeriodsToDate is:
Member_Expression: Any Multidimensional Expression that returns valid Member.
Member_Position: Please specify the position of a member you want to Navigate.
NOTE: LastPeriods Function is used to navigate between same Members level. For example, If we mentioned City member as Member_Expression then LastPeriods function will navigate between remaining Cities, it will not go Level Up (State – Province) or Level down (Postal Code).
In this article we will show you, How to write PeriodsToDate Function examples. For this, we are going to use below shown data.
MDX PERIODSTODATE FUNCTION

MDX PeriodsToDate Function Example 1

In this example we will show you, What happen when we use Zero value for the LastPeriods Function. The following query will return the Internet Sales Amount of Months present in Calender Year 2013 until it reaches July 2013
CODE
OUTPUT
MDX PERIODSTODATE FUNCTION 1
Analysis:
In the above MDX Query, We used [Reseller Sales amount] on the columns
Below line of code will check
for the France parent (Which is All member) and then finds the Last child member of the Country.

MDX PeriodsToDate Function Example 2

In this example we will show you, What happen when we use Positive  integer value in LastPeriods Function. The following query will return the Internet Sales amount of the Calender Year 2013, 2012 and 2011 because LastPeriods function with Positive value (3) will move back 2 years + year 2013. This is because LastPeriods function includes 2013 itself.
CODE
OUTPUT
MDX PERIODSTODATE FUNCTION 2
Thank You for Visiting Our Blog