ClosingPeriod

Returns the last descendant of a layer, or the last child of the Time dimension.

Syntax

ClosingPeriod ( [ layer [,member ]] )
ParameterDescription

layer

Layer specification.

member

Optional member specification. If omitted, the last child of the Time dimension is assumed (for example, Qtr4 in Sample Basic).

Notes

The return value of this function varies depending on the input.

  1. When both layer and member arguments are given as input, Closingperiod returns the last descendant of the input member at the input layer. For example, Closingperiod(Year.generations(3), Qtr3) returns Sep. If the input member and layer are the same layer, the output is the input member. For example, Closingperiod(Year.generations(3), Sep) returns Sep.

  2. When only the layer argument is specified, the input member is assumed to be the current member of the dimension used in the layer argument. Closingperiod returns the last descendant of that dimension, at the input layer. For example, Closingperiod(Year.generations(3)) returns Dec.

  3. When no arguments are specified, the input member is assumed to be the current member of the Time dimension, and ClosingPeriod returns the last child of that member. Do not use this function without arguments if there is no dimension tagged as Time.

Example

The following query

WITH
MEMBER [Measures].[Starting Inventory] AS
'
IIF (
 IsLeaf (Year.CurrentMember),
  [Measures].[Opening Inventory],
  ([Measures].[Opening Inventory],
   OpeningPeriod (
     [Year].Levels(0),
     [Year].CurrentMember
   )
  )
)'

MEMBER [Measures].[Closing Inventory] AS
'
IIF (
   Isleaf(Year.CurrentMember),
    [Measures].[Ending Inventory],  
   ([Measures].[Closing Inventory],
    ClosingPeriod (
    [Year].Levels(0),
    [Year].CurrentMember
    )
)
)'
SELECT
CrossJoin (
 { [100-10] },
 { [Measures].[Starting Inventory], [Measures].[Closing Inventory] }
)
ON COLUMNS,
Hierarchize ( [Year].Members , POST)
ON ROWS
FROM Sample.Basic

returns the grid:

(axis)100-10100-10
(axis)Starting InventoryClosing Inventory
Jan1458714039
Feb1403913566
Mar1356613660
Qtr11458713660
Apr1366014172
May1417215127
Jun1512715580
Qtr21366015580
Jul1558014819
Aug1481914055
Sep1405513424
Qtr31558013424
Oct1342413323
Nov1332313460
Dec1346012915
Qtr41342412915
Year1458712915

See Also