All eazyBI for Jira eazyBI for Confluence Private eazyBI

PreviousPeriods

EAZYBI Returns a set of previous time dimension members starting from the given Time member.

Syntax

PreviousPeriods(Time_Member_Expression)

Arguments

Time_Member_Expression

MDX expression that returns a Time dimension member.

Examples

PreviousPeriods returns an optimized set of previous periods that can be used to aggregate measure values for all previous time periods. The function is often used for finding cumulative values over time, for example, the default measure Cumulative story points resolved, or when all activities of previous periods should be considered to get the value for a current period, for example, the default measure Open issues - to get all the previously created and resolved issues; default measure Issues history - all previous changes in the issue to see the current state or the state at the end of any period.

For example

PreviousPeriods([Time].[2023].[Q2 2023].[Jun 2023].[Jun 03 2023]) 

will return this set:

{
  [Time].[2022],
  [Time].[2023].[Q1 2023],
  [Time].[2023].[Q2 2023].[Apr 2023], [Time].[2023].[Q2 2023].[May 2023],
  [Time].[2023].[Q2 2023].[Jun 2023].[Jun 01 2023], [Time].[2023].[Q2 2023].[Jun 2023].[Jun 02 2023]
}

This shows all years until the previous year (in this example Time dimension starts with year 2022), all current year quarters until the previous quarter (in this example Q1 2023), all current quarter months until the previous month (Apr 2023 and May 2023) and all current month days until the previous day (Jun 01 2023 and Jun 02 2023).

The following formula can be used to calculate a cumulative sum of resolved issues until the previous period:

Sum(
  PreviousPeriods([Time].CurrentHierarchyMember),
  [Measures].[Issues resolved]
)

If we want to calculate a cumulative sum of resolved issues, including the current period, then we need to add the current period to the previous periods set:

Sum(
  {PreviousPeriods([Time].CurrentHierarchyMember),
   [Time].CurrentHierarchyMember},
  [Measures].[Issues resolved]
)

See also:

  • To find the set of future time dimension members, use the FuturePeriods() function.