“The restrictions imposed by the CONSTRAINED flag … were violated”

南笙酒味 提交于 2020-01-05 07:58:35

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!