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


MDX query set does not display correct result.


MDX query set does not display correct result.

Author
Message
amit_pjoshi
amit_pjoshi
SSC Rookie
SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)SSC Rookie (28 reputation)

Group: General Forum Members
Points: 28 Visits: 78
Hello Experts,

Can you please suggest me the alternate solution of following MDX query issue please its very Urgent:

The following set of COMP_YTD_CP is works fine with single brand but when user selectes multiple brand it always takes min value of the First Invoice Month irrespective of current memebre of the brand
For e.g: Brand First Invoice Month
B1 201202
B2 201107
B3 201101
B4 201204
In this case, for all the brands first invoice date is considerd as 201101 inspite of different first invoice dates mentioned above next to the brand.


WITH

SET SP
AS STRTOMEMBER(“[Time].[Fiscal Hierarchy].&[201204]”)

MEMBER [Measures].[First Invoice Year] AS
Head(
NonEmpty(
EXISTING [Time].[Fiscal Hierarchy].[FiscalYear].Members,
([Measures].[Sales Quantity])
),
1
).Item(0).properties("key", TYPED)

SET ALL_Months_Selected_Year
AS Descendants(Ancestor(SP.item(0),[Time].[Fiscal Hierarchy].[FiscalYear]), [Time].[Fiscal Hierarchy].[FiscalMonth])

//--Getting Month previous to the First Invoice Month and then getting PeriodsToDates
SET ALL_Months_Till_First_Invoiced_Month
AS PERIODSTODATE([Time].[Fiscal Hierarchy].[FiscalYear],
PARALLELPERIOD([Time].[Fiscal Hierarchy].[FiscalYear], -1,
Head( NonEmpty( EXISTING [Time].[Fiscal Hierarchy].[FiscalMonth].Members,
([Measures].[JBA Sales Quantity]) ), 1).Item(0)))

SET COMP_SET_SUBSTRACT_CP
AS EXCEPT(ALL_Months_Selected_Year, ALL_Months_Till_First_Invoiced_Month)

SET COMP_YTD_CP
AS IIF([Measures].[Selected Year]-1 > [Measures].[First Invoice Year],
SP.item(0) ,
IIF([Measures].[Selected Year]=[Measures].[First Invoice Year] ,
NULL,
INTERSECT(SP, COMP_SET_SUBSTRACT_CP))
)
MEMBER [MEASURES].[SALES YTD CP COMP]
AS SUM(COMP_YTD_CP, [Measures].[Revenues])
SELECT
{[MEASURES].[SALES YTD CP COMP]} ON COLUMNS,
Nonempty( {[Brand].[Brand].[Brand Major].members
* [Customer].[Country].[Country]* [Currency].[Currency].[Currency]})on rows FROM [Cube1]
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16469 Visits: 13207
Please do not crosspost. It wastes peoples time and fragment replies.
Original thread with replies can be found here:
http://www.sqlservercentral.com/Forums/Topic1509687-17-1.aspx



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
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