# Lag, Lead, NextMember, PrevMember, FirstSibling, LastSibling, Siblings and LastPeriods

Lags and Leads are the equivalent of Dnext/Dprev.
`{ [Date].[2006-10-03].Lead(1) }`
will return 2006-10-04.

Lead(n) is the same as Lag(-n) so either function can be used in place of the other by using a negative value, but if only one direction will ever be needed in a given situation then you should use the correct one for understandability’s sake. Note that they only return a single member so to return the set of members between two members you can use the lastperiods function.

Equally you can use NextMember and PrevMember when you only need to move along by 1 element.
`{ [Date].[2006-10-03].NextMember }`
Or:
`{ [Date].[2006-10-03].PrevMember }`

To return the 6 months preceding, and including, a specific date:
`{ LastPeriods(6, [Date].[2006-10-03]) }`
Or:
`LastPeriods(6, [Date].[2006-10-03])`
Both of which work because LastPeriods is a function that returns a set, and TM1 always requires a set. Curly braces convert a result into a set which is why many TM1 subset definitions are wrapped in a pair of curly braces, but in this case they are not required.

This will return the rest (or the ones before) of a dimension's members at the same level, from a specified member. Despite its name LastPeriods works on any kind of dimension:
`{ LastPeriods(-9999999, [Date].[2006-10-03]) }`

Siblings are members who share a common parent. For example, a date of 14th March 2008 will have siblings of all the other dates in March the first of which is the 1st March and the last of which is 31st March. A cost centre under “West Coast Branches” would have a set of siblings of the other west coast branches.

The FirstSibling function returns the first member that shares a parent with the named member. For example:
`{[Product].[MidasHCFI].FirstSibling}`
Returns “MidasHCBK”.
While:
`{[Product].[MidasHCFI].LastSibling}`
Returns “MidasHSFI”.

The siblings function should return the whole set of siblings for a given member. TM1 9.0 SP2 through to 9.1.2.49 appear to give you the entire set of members at the same level (counting from the top down) rather than the set of siblings from FirstSibling through to LastSibling only.
`{[Product].[MidasHCFI].Siblings}`

Categories