Joe
Joe

Reputation: 47

Running Total in MDX

Hi guys I need help I want this result i have trying different queries with MDX in SSAS but doesn't work.

Thank you !

enter image description here

Upvotes: 1

Views: 726

Answers (2)

Joe
Joe

Reputation: 47

Thank you MoazRub for your answer I used this query and it's work :

enter link description here

WITH MEMBER [Measures].[Running Total] AS
  Aggregate (
    { [Date].[Calendar].CurrentMember.Parent.FirstChild : [Date].[Calendar].CurrentMember },
    [Measures].[Internet Sales Amount]
  )
SELECT
{ [Measures].[Internet Sales Amount], [Measures].[Running Total] } ON 0,
[Date].[Calendar].[Month].&[2011]&[1].Children ON 1
FROM [Adventure Works]

Upvotes: 1

MoazRub
MoazRub

Reputation: 2911

You want to have a running total in your result. Take a look at the example below

with 
member 
[Measures].[Internet Sales AmountRunningtotal]
as 
case when [Measures].[Internet Sales Amount] = null then null 
else 
sum({[Product].[Subcategory].firstchild:[Product].[Subcategory].currentmember},[Measures].[Internet Sales Amount])
end
select {[Measures].[Internet Sales Amount],
[Measures].[Internet Sales AmountRunningtotal]
} on columns,

non empty
([Date].[Calendar Year].[Calendar Year],[Date].[Calendar Quarter of Year].[Calendar Quarter of Year],
[Product].[Category].[Category],[Product].[Subcategory].[Subcategory])
on 
rows 
from 
[Adventure Works]

Result enter image description here

Upvotes: 1

Related Questions