Returns a member list from the start of the week to the specified date member.

  • Returned Output: List
  • Library: PQL \ Semantic \ Date-Time
  • Version: 2020.10.000
  • Compatibility: Pyramid Query Language (PQL) data sources


WTD( <Member> , OPTIONAL <Day Integer> )

* Click on the function's arguments above for more details on the input values.

  • The member needs to be an existing member from either:
    • a date-time flagged attribute in the model.
    • a regular, multilevel hierarchy where there is a level of type "week"
  • The optional start day integer is used to flag weeks that don't begin on Sunday. Either provide an integer for the start of the week (Sunday=1, Monday=2 etc) or use a 3 character flag (SUN, MON, TUE, etc). This is only operational with the attribute formulation.
  • For details on how to employ and use this function see the semantic calculation overview.
Attribute vs Regular Hierarchy Formulations

When this function is used on a flat attribute / column of type "date-time", the function builds a set of members starting from the start of the week specified. This can be further modulated using the optional day integer or flag offset, to change what day the week is supposed to start from. In effect, the dates in the attribute drive the logic based on their actual date-time values.

When the function is used on a regular hierarchy (with multiple levels), the function returns all the elements in the same level starting with the first one found under the same parent item in the WEEK level all the way up to itself. In effect, the logic ignores the date-time value of the elements and instead resolves the calculation based on the hierarchy and the parent item found specifically in the week level. If there is no week level, this function will not work.

Different Function types
  • This attribute formulation is similar the full week function, but it calculates the range of dates from the start of the week to the specified date.
  • This regular hierarchical formulation is similar to the MDX "WTD" function.


The WTD function using a date of 2016-02-05 produces a list of dates starting January 31 2016 -Feb 5 2016 when applied to the flat hierarchy called "dateKey".

WTD( [data].[dateKey].[1454630400000] )

The WTD function using a member 2018-09-26 produces a list of dates starting with the first child of 39th week through to this member, since W39 is marked as a member in a week level in the regular hierarchy called "Date".

WTD( [Date].^[Hierarchy].[2008].[W39].[2018-09-26] )