Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Group By MDX for YTD


Group By MDX for YTD

Author
Message
venkyzrocks
venkyzrocks
Valued Member
Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)Valued Member (73 reputation)

Group: General Forum Members
Points: 73 Visits: 430
HI,

I'm New to MDX querying, so looking for some help here :

This is the query that got generated out of profiler :



SELECT CROSSJOIN( { [Fiscal_Year].[2014] },
{ [Period].[Jun], [Period].[Jul] },
{ ADDCALCULATEDMEMBERS([Function].[All Function].Children) })
ON 0 ,
NON EMPTY CROSSJOIN( { [Fund].[10]}, { [Account_Code].[ABCD] }) ON 1
FROM [TFA_Budget2]
WHERE ( [Measures].[Value])




2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014 2014
Jun Jun Jun Jun Jun Jun Jul Jul Jul Jul Jul Jul
A B C D E F A B C D E F
10 ABCD 10 20 30 40 50 60 10 20 30 40 50 60



Result Set

2014 2014 2014 2014 2014 2014
Total Total Total Total Total Total
A B C D E F
10 ABCD 20 40 60 80 100 120







So we total sum(A) for Jun and JUly and put it in Total.

Thanks in advance.
kupy
kupy
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1074 Visits: 2647
Hi,

Try something like this


With Member [Period].[Total] as ( [Period].[Jun] + [Period].[Jul])
SELECT CROSSJOIN( { [Fiscal_Year].[2014] },
{ [Period].[Total] },
{ ADDCALCULATEDMEMBERS([Function].[All Function].Children) })
ON 0 ,
NON EMPTY CROSSJOIN( { [Fund].[10]}, { [Account_Code].[ABCD] }) ON 1
FROM [TFA_Budget2]
WHERE ( [Measures].[Value])


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search