whytheq
whytheq

Reputation: 35557

Query Date dimension for days during past 5 months

Is this the most trustworthy and efficient method of extracting the days for the past 5 months from a Date dimension

{DESCENDANTS( 
    Tail([Date].[Date - Calendar Month].[Calendar Month].Members,5), 
    [Date].[Date - Calendar Month].[Calendar Day] 
    )} 

I believe the dimension I'm querying is relatively standard:

enter image description here

Upvotes: 2

Views: 86

Answers (1)

blacelle
blacelle

Reputation: 2217

You may prefer this alternative syntax:

{
     DESCENDANTS( 
        {[Date].[Date - Calendar Month].[Calendar Month].LastChild.Lag(5) : 
         [Date].[Date - Calendar Month].[Calendar Month].LastChild}
        , [Date].[Date - Calendar Month].[Calendar Day] 
    )
} 

and optionally change

[Date].[Date - Calendar Month].[Calendar Month].LastChild

by another member expression

Upvotes: 3

Related Questions