I have several section of similar MDX code that has been created in Microsoft SQl Server Management Studio using cube data and I now need to use the code in a SSRS paginated report. I'm getting the following error:
"Query (4, 2) The restrictions imposed by the CONSTRAINED flag in the
STRTOMEMBER function were violated."
This code works fine in Management Studio and SSRS using a date but as soon as I change the date to a parameter I get the error.
MEMBER [Measures].[Sales in Period2] AS
AGGREGATE (
{STRTOMEMBER("[Paid Date].[Date].&[2020-11-01]", CONSTRAINED) : STRTOMEMBER("
[Paid Date].[Date].&[2020-11-30]", CONSTRAINED) }
, [Measures].[Paid Amount]
),FORMAT_STRING = "#.00;(#.00);0;0"
I've tried changing:
[2020-11-01] to [@StartDate1],
[2020-11-01] to [" + @ParameterName + "],
STRTOMEMBER to STRTOSET, and
remove CONSTRAINED.
="MEMBER [Measures].[Sales in Period2] ... {STRTOMEMBER(""[Paid Date].[Date].&[" & FORMAT(@Parameter, "yyyy-MM-dd") & ""]", CONSTRAINED) ...
– Hannover Fist