Head
The Head function returns the specified number of tuples from the beginning 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 Head function returns an empty set. If the specified number of tuples exceeds the number of tuples in the set, the function returns the original set.
Syntax
Head( 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 first 5 closed sprints
AVG( Head( Filter( -- filter the set of last 5 previous sprints in a board starting from first sprint {[Sprint].CurrentMember.FirstSibling: [Sprint].CurrentMember}, [Sprint].CurrentMember.GetBoolean("Closed") ), -- set the count of first closed sprints for first velocity 5 ) , [Measures].[Sprint Story Points completed] )
Quite often Head is used together with Order or Filter function when you need to a certain set from the end by some rules.
See an example report Cumulative flow diagram for selected period in our demo account. The calculated measure "First date in report" uses the Head function to find the first timestamp from the visible date members in the report