SSRS error in MDX expression syntax is incorrect
I have a 2008 SSRS report error: An error has occurred during report processing,(rsProcessing Aborted) query execution failed for dataset 'Consumption' (rsErrorExecutingCommand) Query (7,52) parser: the syntax for 'Count is incorrect. This SSRS report is on
the AX 2009 Role Center page. Here is the MDX expression:
WITH
MEMBER [Measures].[Deviation]
as
([Consumption Deviation])
SELECT
{[Measures].[Actual Consumption],[Measures].[Budget Consumption],[Measures].[Deviation]}
on 0,
{([Projects].[Project type].[Project type].
ALLMEMBERS *
Topcount
([Projects].[Projects].[Projects].members,@count, [Measures].[Deviation]))}
on 1
FROM
[Project Accounting Cube]
WHERE
(
STRTOMEMBER('[Company].[Company accounts].&[' + @Company + ']'),
STRTOMEMBER
('[Forecast models].[Model].&[' + @Company + ']&[' + @ForecastModel + ']'),
STRTOMEMBER
('[Projects].[Project manager].&[' + @Company + ']&[' + @ProjManager + ']'),
{
STRTOMEMBER("[Project date].[Years Quarters Months Weeks Days].[Days].&[" + format(CDate(@ProjectDate1), "yyyy-MM-dd")
+ "T00:00:00]")
:
STRTOMEMBER("[Project date].[Years Quarters Months Weeks Days].[Days].&[" + format(CDate(@ProjectDate2), "yyyy-MM-dd")
+ "T00:00:00]")},
{
STRTOMEMBER("[Ledger date].[Years Quarters Months Weeks Days].[Days].&[" + format(CDate(@LedgerDate1), "yyyy-MM-dd")
+ "T00:00:00]")
:
STRTOMEMBER("[Ledger date].[Years Quarters Months Weeks Days].[Days].&[" + format(CDate(@LedgerDate2), "yyyy-MM-dd")
+ "T00:00:00]")},
[Master Company Reporting Currency].[Currency].&[Local])
March 14th, 2011 5:00pm
When I run a syntax check on your query in management studio it reveals that the issue is with the following line :-
([Projects].[Projects].[Projects].members,@count , [Measures].[Deviation]))} on 1
Query (25, 44) Parser: The syntax for 'count' is incorrect.
Do you have a parameter declared for this placeholder and is it mapping correctly? It would seem it's not being replaced for some reason when the query is run.
Free Windows Admin Tool Kit Click here and download it now
March 14th, 2011 7:33pm
Josh,
The only parameter I have that comes close to that is called Consumption_Count and here are the values for that parameter:
allow blank false
data type system.string
dataset parameter Count
Default value 5
Multi value false
Name Consumption_Count
Nullable false
Prompt string Count
Values is blank
visibility visable
March 15th, 2011 1:41pm
The function call you are making, TOPCOUNT, expects a parameter that is obviously the number of top records you want to return. That is what is needed where the @count parameter is in your query.
In the dataset, under the Parameters section, you should see an entry for the @count parameter in the query, that specifies what the value is.
It looks like you need to add an entry there, or alternatively replace the @count keyword in the query with a number.
Free Windows Admin Tool Kit Click here and download it now
March 15th, 2011 7:25pm
Okc, were you able to resolve this error? We are having the same issue.
March 21st, 2011 8:37pm
If you have a string such as "@string" somewhere in a query, and it is not mapped correctly in the reporting services parameter section, it will send that string directly to the provider with no substitution of parameter values.
That will cause an error like the above.
Free Windows Admin Tool Kit Click here and download it now
March 21st, 2011 9:46pm