PeriodsToDate I am getting frustrated

  • I have a timedimension with three attributes

    Month

    PK Date (Date)

    Year

    And a hierachy of Year - Month - PK Date

    I have a measure called Antal (count), and I want to be able to get a sum from the beginning to current date. It is showing warehousefigures.

    I have this MDX:

    with member measures.ptd as

    sum(PeriodsToDate([Time Dimension].[PK Date], [Time Dimension].[PK Date].currentmember), [Measures].[Antal]

    )

    Select

    {

    measures.ptd

    } on columns,

    {

    [Time Dimension].members

    } on rows

    from [LagerKube]

    Why does that not work. Any comments. the error I get is:

    The 'Time Dimension' dimension contains more than one hierarchy, therefore the hierarchy must be explicitly specified.

    Søren,
    MCITP SQL 2008 (administration / programming), MCITP SQL 2005 (BI), MCT

  • It seems like it's not happy with the 'time dim.members', you need to tell the query/engine which members, that is, from which hierarchy (remembering that every attribute is in fact an 'attribute hierarchy'). Try something like the following.

    with member measures.ptd as

    sum(PeriodsToDate([Time Dimension].[PK Date], [Time Dimension].[PK Date].currentmember), [Measures].[Antal]

    )

    Select

    {

    measures.ptd

    } on columns,

    {

    [Time Dimension].[PK Date].members

    } on rows

    from [LagerKube]

    HTH,

    Steve.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply