Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

MDX with subselect and measure using current member function

$
0
0

Hello,

Is there a best practice for having an MDX measure that references the currentmember function work in a subselect? Given the example below based off of AdventureWorks we have a measure that gets the prior year orders using paralle period and currentmember:

WITH
MEMBER [Measures].[Prior Orders]
AS
‘([Measures].[Internet Order Count], ParallelPeriod([Date].[Calendar].[Calendar Year], 1, [Date].[Calendar].CurrentMember))’
select
{[Measures].[Order Count], [Measures].[Prior Orders]} on columns,
Hierarchize(
Generate
(
{[Date].[Calendar].[Calendar Quarter].&[2007]&[1]}
,Ascendants([Date].[Calendar].CurrentMember)
)
)
on rows
from
(
select
{[Date].[Calendar].[Calendar Quarter].&[2007]&[1]} on columns
from [Adventure Works]
)

We see the following returned:

Order Count Prior Orders
All Periods 1,091 (null)
CY 2007 1,091 2677
H1 CY 2007 1,091 1193
Q1 CY 2007 1,091 558

We are expecting the Prior Orders to be 558 for all the ascendants for Q1 2007.
Would there be a general approach for detecting the subselect and adjust the calculation in this case.

Thanks for your help.


Viewing all articles
Browse latest Browse all 14337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>