简体   繁体   中英

SSAS MDX sum up on memberships in date hierarchies?

In a cube that contains memberships of a club, I have a column MembersInOut in my fact-table which holds when a member joined the club (Value = 1) and leaving (value = -1). The Club started jan 1. 2000. so no members before that date.

Now to know the current number of members on a specific date I can do this:

CREATE MEMBER CURRENTCUBE.[Measures].[Calculated MembersOfTheClub]
AS

     Sum(
            {[Date Dim].[Date].&[2000-01-01T00:00:00]: 
             [Date Dim].[Date].currentmember},
             [Measures].[MembersInOut] 
            )

This works fine on the actuel date, but how to make this work on a date hierarchie [Year-Month-day] ?

Thanks

You could create YMD hierarchy, then use expression like below

with member[Measures].[S1] AS
sum(
      {NULL:[Date].[Calendar Date].CurrentMember}  
    , [Measures].[Internet Sales Count])

select nonempty ([Date].[Calendar Date].members) on rows, nonempty ({[Measures].[S1],[Measures].[Internet Sales Count]}) on columns from [Analysis Services Tutorial]

在此处输入图片说明

Zoe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM