I have built a multidimensional SSAS
cube with some calculations. I have a calculated member in which I use the the parallelperiod
function to calculate the previous month value according to the following code :
Sum
(
(EXISTING
[TimeDim Transactions].[Year - Quarter - Month - Date].[date].MEMBERS)
,(
ParallelPeriod
(
[TimeDim Transactions].[Year - Quarter - Month - Date].[month]
,1
,[TimeDim Transactions].[Year - Quarter - Month - Date].CurrentMember
)
,[Measures].[Net Amount]
)
)
When I run the following query it works as expected.
SELECT
{
NetAmountSamePeriodLastMonth
,[Measures].[net amount]
} ON COLUMNS
,[Stores Dim].[Store Code].Children ON ROWS
FROM [SalesDW_v1]
WHERE
{
[TimeDim Transactions].[Year - Quarter - Month - Date].[Date].&[2014-12-04T00:00:00]
,[TimeDim Transactions].[Year - Quarter - Month - Date].[Date].&[2014-12-05T00:00:00]
};
But when I browse the cube to get the same data with the same date filters It gives wrong numbers. The generated from browser mdx script is :
SELECT
NON EMPTY
{
[Measures].[Net Amount]
,[Measures].[NetAmountSamePeriodLastMonth]
} ON COLUMNS
,NON EMPTY
{[Stores Dim].[Store Code].[Store Code].ALLMEMBERS}
DIMENSION PROPERTIES
MEMBER_CAPTION
,MEMBER_UNIQUE_NAME
ON ROWS
FROM
(
SELECT
{
[TimeDim Transactions].[Year - Quarter - Month - Date].[Date].&[2014-12-04T00:00:00]
,[TimeDim Transactions].[Year - Quarter - Month - Date].[Date].&[2014-12-05T00:00:00]
} ON COLUMNS
FROM [SalesDW_v1]
)
WHERE
[TimeDim Transactions].[Year - Quarter - Month - Date].CurrentMember
CELL PROPERTIES
VALUE
,BACK_COLOR
,FORE_COLOR
,FORMATTED_VALUE
,FORMAT_STRING
,FONT_NAME
,FONT_SIZE
,FONT_FLAGS;
Something more, the browser shows correct numbers when one date is selected.
Is there a way to modify the calculated member in order to work correctly at the browser. I present the data on a power view report, but what i get is the incorrect numbers I see at the browser.
Below the code generated by browser when I use only one date member :
SELECT
NON EMPTY
{ [Measures].[Net Amount]
,[Measures].[NetAmountSamePeriodLastMonth]
}
ON COLUMNS
,NON EMPTY
{ ([Stores Dim].[Store Code].[Store Code].ALLMEMBERS ) }
DIMENSION PROPERTIES
MEMBER_CAPTION
,MEMBER_UNIQUE_NAME ON ROWS
FROM
(
SELECT (
{[TimeDim Transactions].[Year - Quarter - Month - Date].[Date].&[2014-12-05T00:00:00] }
) ON COLUMNS
FROM [SalesDW_v1]
)
WHERE ( [TimeDim Transactions].[Year - Quarter - Month - Date].[Date].&[2014-12-05T00:00:00] )
CELL PROPERTIES VALUE
, BACK_COLOR, FORE_COLOR
, FORMATTED_VALUE
, FORMAT_STRING
, FONT_NAME
, FONT_SIZE
, FONT_FLAGS