Link to home
Start Free TrialLog in
Avatar of trawley
trawley

asked on

Cumulative or Running totals in MDX

Hi all

I am trying to create the cumulativeactivitycount in this example in my cube db:

User generated image
I have managed it but have done so using a count of months in the year and a case statement so:

case
when [Date From Source Data].[Fiscal Month] = [Date From Source Data].[Fiscal Month].[Fiscal Month Name].&[1]
then ([Measures].[Activity Count],[Date From Source Data].[Fiscal Month].[Fiscal Month Name].&[1])
when [Date From Source Data].[Fiscal Month] = [Date From Source Data].[Fiscal Month].[Fiscal Month Name].&[2]
then ([Measures].[Activity Count],[Date From Source Data].[Fiscal Month].[Fiscal Month Name].&[1])+([Measures].[Activity Count],[Date From Source Data].[Fiscal Month].[Fiscal Month Name].&[2]) and so on and so forth right up to 12...

The problem with this is that it is really slow and is causing performance issues with any report suite that tries to use it.

I've also tried:

SUM({NULL:[Date From Source Data].[Fiscal YQM].currentmember},[Measures].[Activity Count])

Which works as it should do but doesn't restart in April at the beginning of each Fiscal Year.

The PeriodsToDate and YTD, MTD, QTD functions in MDX seem to give you just one value across all months which is the total of the accumulated value for the year which is not what I want.

Any help here would be gratefully received. The cumulative member I created in the first example worked OK for one organisation but it now has to work for 23 (so in other words we have over 23 times the amount of records in the fact table) so I need something slicker.
ASKER CERTIFIED SOLUTION
Avatar of Phillip Burton
Phillip Burton

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of trawley
trawley

ASKER

Reasons in comment above.