CurrentHierarchyMember
EAZYBI When iterating through the set of members in the currently used hierarchy, the CurrentHierarchyMember function dynamically returns the member being operated upon. It is like saying, "You are here," and the value is calculated for this particular member.
Syntax
Dimension_Expression.CurrentHierarchyMember
Arguments
Dimension_Expression | MDX expression that returns a dimension in the currently used hierarchy |
---|
Examples
Example with Time
[Time].CurrentHierarchyMember
can be used in calculated member formulas to handle both [Time].CurrentMember
and [Time.Weekly].CurrentMember
cases.
The example below verifies if the Time dimension is used on the report with a particular period or not used in the report. The formula validates if All Times (default member) is used in the report or Time dimension is absent from the report.
[Time].CurrentHierarchyMember is [Time].CurrentHierarchy.DefaultMember
See example report Control chart (cycle time) in our Demo account. Time dimension usage in the report might impact calculation. The calculated measures Rolling Average cycle time and Rolling Average cycle time alternative uses a formula above to validate if the Time dimension is used in the report. If no time dimension is used in the report a simple calculation for a cycle time can be used. The report uses Time dimension in the report, therefore, in the particular example the more complex calculation with iteration through issues is needed.
Example with DescendantsSet
The following example would pull in all workdays until yesterday for any report selection and count the average of resolved issues per day.
-- count average resolved issues for any weekday for a selected time period Avg(Filter( -- access all days for a selected time period DescendantsSet([Time].CurrentHierarchyMember,[Time].CurrentHierarchy.Levels("Day")), -- exclude weekend NOT [Time].CurrentHierarchyMember.Get('Week day name') MATCHES "Saturday|Sunday" AND -- count till yesterday only to include full completed days DateCompare([Time].CurrentHierarchyMember.StartDate, "Yesterday") <=0 ), -- count resolved issues or 0 if there are no resolved issues in a weekday CoalesceEmpty([Measures].[Issues resolved] ,0) )
See the example report Kanban project overview in our demo account. The calculated measure Average throughput uses the formula above to average of daily resolved issues.