问题
I am new to ssrs .i am creating report which query on cube and provides the result i have used parameter for choosing to and from date and its giving error like "the restriction imposed by constrained flag is violated". what should i do ?i can not remove constrained because production server does not accepts mdx query without constrained. MDX Query is like this:-
select
{[Measures].[Customers],[Measures].[Contacted Customers],
[Measures].[No of Bets],
[Measures].[Stakes GBP],
[Measures].[Turnover GBP],[Measures].[Signups]
} ON COLUMNS,
NON EMPTY{
[Date].[Calendar Date].[Date].allmembers
}
ON ROWS
FROM ( SELECT ( STRTOMEMBER(@mdxfromdate, CONSTRAINED) :
STRTOMEMBER(@mdxtodate, CONSTRAINED) ) ON COLUMNS
from [SportsWarehouse])
回答1:
The error is telling you that the value in @mdxfromdate
isn't the name of a member. StrToMember()
will not convert a generic date string to a member -- it needs to be something like:
[Date].[Calendar Date].[Date].&[19]
(to use an Adventure Works example), or whatever format the members of your Date hierarchy are in. If you want to only specify part of the fully-qualified name, you could build the name up dynamically as well:
StrToMember("[Date].[Calendar Date].[Date].&[" & @mdxfromdate & "]", CONSTRAINED)
Hope that helps.
来源:https://stackoverflow.com/questions/16044966/the-restrictions-imposed-by-the-constrained-flag-were-violated