#
Tail

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, Numeric_Expression)

## Arguments

Set_Expression | MDX expression that returns a set of members. |
---|---|

Numeric_Expression | MDX expression that returns an integer number 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] )

Usually, the Tail function is used together with the Order or Filter functions when you need to extract a certain subset of members.

See the 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 the last 5 closed sprints