SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Simple MDX query


Simple MDX query

Author
Message
s_osborne2
s_osborne2
SSC Eights!
SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)

Group: General Forum Members
Points: 997 Visits: 2292
Hi,

I'm trying to something that I think should be straight forward in MDX but i'm struggling. I'm new to MDX so it seems trivial but may not be....

Consider the following query:

SELECT
[Measures].[Thing Count] ON 0,
YTD([Effective Date].[Year-Week].[Week].[2013 Week 6]) ON 1
FROM
[Cube]



This gives me a result set that shows as per the attached. All i really want though is the SUM of the rows. How do i do that? It's driving me nuts because i'm sure it's a piece of cake.

Thanks,


Simon



MCSE: Data Platform
MCSE: Business Intelligence
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
Attachments
Query.png (11 views, 3.00 KB)
Mackers
Mackers
SSC Veteran
SSC Veteran (227 reputation)SSC Veteran (227 reputation)SSC Veteran (227 reputation)SSC Veteran (227 reputation)SSC Veteran (227 reputation)SSC Veteran (227 reputation)SSC Veteran (227 reputation)SSC Veteran (227 reputation)

Group: General Forum Members
Points: 227 Visits: 499
Try something along the lines of


With Member [Measures].[Thing Count YTD] As

Sum(YTD([Effective Date].[Year-Week].CurrentMember)
, [Measures].[Thing Count] )

SELECT
[Measures].[Thing Count YTD] ON 0,
[Effective Date].[Year-Week].[Week].[2013 Week 6] ON 1
FROM
[Cube]



Mack
s_osborne2
s_osborne2
SSC Eights!
SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)SSC Eights! (997 reputation)

Group: General Forum Members
Points: 997 Visits: 2292
That's great thanks!



MCSE: Data Platform
MCSE: Business Intelligence
Follow me on Twitter: @WazzTheBadger
LinkedIn Profile: Simon Osborne
MMartin1
MMartin1
SSCrazy
SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)SSCrazy (2.7K reputation)

Group: General Forum Members
Points: 2747 Visits: 2031
Try this also...
With Member [Measures].[Thing Count YTD] As

AGGREGATE(YTD([Effective Date].[Year-Week].CurrentMember)
, [Measures].[Thing Count] )

SELECT
[Measures].[Thing Count YTD] ON 0,
[Effective Date].[Year-Week].[Week].[2013 Week 6] ON 1
FROM
[Cube]



This keeps whatever it is you are counting from being double counted.

----------------------------------------------------
How to post forum questions to get the best help
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