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


MDX Query Help - Different conditions in the same query


MDX Query Help - Different conditions in the same query

Author
Message
Polymar
Polymar
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 72
Hello,
I'm quite new to MDX syntax and I'm trying to get to this:
Measures
Actual
Budget
Dimensions
Owner
Job
FY
Month
Status
I'd want to extract, given an Owner and a FY (which I need in the rows)
-all the actual and budget amounts by FY/Month/Job for every status in the current FY
-all the actual and budget amounts only for a certain status for the previous year
I managed to build something like that, but I can't get to insert the second condition!

SELECT NON EMPTY
{
[Measures].[Actual],
[Measures].[Budget],
} ON COLUMNS,
NON EMPTY
{
(
STRTOSET(@Owner) *
[Job].[Job].[Job].ALLMEMBERS *
STRTOSET(@FY) *
[Date].[Simple Date].[Month].ALLMEMBERS *
[Status].[Status].[Status].ALLMEMBERS
)
}
ON ROWS
From [Cube]

Can someone point me in the right direction? Thanks in advance
Renato
Nkl
Nkl
SSC-Enthusiastic
SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)SSC-Enthusiastic (154 reputation)

Group: General Forum Members
Points: 154 Visits: 88
try something like this :
NON EMPTY
{
(
STRTOSET(@Owner) *
[Job].[Job].[Job].ALLMEMBERS *
STRTOSET(@FY) *
[Date].[Simple Date].[year].[2018].children * --assuming month is the level under year, if you have semester/quarters you have to adjust it
[Status].[Status].[Status].ALLMEMBERS
)
+
(
STRTOSET(@Owner) *
[Job].[Job].[Job].ALLMEMBERS *
STRTOSET(@FY) *
[Date].[Simple Date].[year].[2018].children * --assuming month is the level under year, if you have semester/quarters you have to adjust it
--here put a set with all the status you want
)

}
Polymar
Polymar
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 Visits: 72
Hi Nkl, thank you very much. Meanwhile a got around the issue by working in SSRS and filtering there the values, but your solution is cleaner.
Thanks again!
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