Tail
The Tail function returns the specified number of tuples from the end of the specified set. The order of elements is preserved. The default value of Count is 1. If the specified number of tuples is less than 1, the function returns the empty set. If the specified number of tuples exceeds the number of tuples in the set, the function returns the original set.
Syntax
Tail( Set_Expression , count )
Arguments
Set_Expression | MDX expression that returns a set of members. |
---|---|
Count | MDX expression that specifies the number of tuples to be returned. |
Examples
The following formula will return the calculate the average velocity from the last 5 closed sprints
AVG( Tail( Filter( -- filter the set of last 5 previous sprints in a board starting from current sprint {[Sprint].CurrentMember.FirstSibling: [Sprint].CurrentMember}, [Sprint].CurrentMember.GetBoolean("Closed") ), -- set the count of last closed sprints for running velocity 5 ) , [Measures].[Sprint Story Points completed] )
Very often Tail is used together with Order or Filter function when you need to a certain set from the end by some rules.
See example report Sprint velocity chart in our demo account. The calculated measure "Sprint running velocity in board" uses the Tail function to calculate the average velocity from last 5 closed sprints