Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns a set of sibling members from the same level as a given member, starting with the first sibling and ending with the given member, as constrained by the Year level in the Time dimension.
Ytd( [ Member_Expression ] )
Member_Expression
A valid Multidimensional Expressions (MDX) expression that returns a member.
If a member expression is not specified, the default is the current member of the first hierarchy with a level of type Years in the first dimension of type Time in the measure group.
The Ytd function is a shortcut function for the PeriodsToDate function where the Type property of the attribute hierarchy on which the level is based is set to Years. That is, Ytd(Member_Expression)
is equivalent to PeriodsToDate(Year_Level_Expression,Member_Expression)
. Note that this function will not work when the Type property is set to FiscalYears.
The following example returns the sum of the Measures.[Order Quantity]
member, aggregated over the first eight months of calendar year 2003 that are contained in the Date
dimension, from the Adventure Works cube.
WITH MEMBER [Date].[Calendar].[First8MonthsCY2003] AS
Aggregate(
YTD([Date].[Calendar].[Month].[August 2003])
)
SELECT
[Date].[Calendar].[First8MonthsCY2003] ON COLUMNS,
[Product].[Category].Children ON ROWS
FROM
[Adventure Works]
WHERE
[Measures].[Order Quantity]
Ytd is frequently used in combination with no parameters specified, meaning that the CurrentMember (MDX) function will display a running cumulative year-to-date total in a report, as shown in the following query:
WITH MEMBER MEASURES.YTDDEMO AS
AGGREGATE(YTD(), [Measures].[Internet Sales Amount])
SELECT {[Measures].[Internet Sales Amount], MEASURES.YTDDEMO} ON 0,
[Date].[Calendar].MEMBERS ON 1
FROM [Adventure Works]
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!