问题
I'd like to test a MDX query in SSAS. I did the following steps until now.
- I opened the SQL Profiler and ran the SSRS report
- I found the query I needed (with parameter values) and selected it sql profiler
- I pasted the code in ssas
- Since my SSRS MDX query used StrToMember and StrToSet functions, I surrounded the parameter values with quotes, e.g. “[Measures].[Return On Average Assets]”.
The query
SELECT
{
[Measures].[Broj Pristapi]
,[Measures].[Broj Nalozi]
} ON 0
,
Except
(
StrToSet("[Dim Ucesnici].[Naziv Ucesnik].&;[owiefwjhoef]")
,{
[Dim Ucesnici].[Naziv Ucesnik].&[kihebrgk]
,[Dim Ucesnici].[Name].&[blablabla]
}
)*
StrToSet
("{ [Dim Web Service Web Method].[Web Service].&;[wsINAPBan],
[Dim Web Service Web Method].[Web Service].&;[wsNAPSBan] }"
)*
StrToSet
("{ [Dim Web Service Web Method].[Web Method].[All]
,[Dim Web Service Web Method].[Web Method].&;[funNN_loadPP30Ban]
,[Dim Web Service Web Method].[Web Method].&;[funNN_loadPP50Ban]}"
)*
{
StrToMember("[Dim Datumi].[Datum ID].&;[20170801]")
:
StrToMember("[Dim Datumi].[Datum ID].&;[20170906]")
}*
StrToSet("[Dim Ucesnici].[Opis Tip Ucesnik].&;[Bank]") ON 1
,NON EMPTY
{
[Dim Date].[Date].Children*
[Dim Date].[Month].Children*
[Dim Date].[MonthName].Children
} ON 2
FROM [DW];
- I commented out the rest of the lines and just left the mdx query 6.When I ran the query it gave me an error "An MDX expression was expected while a full statement was specified."
I followed the following tutorial for my mdx testing http://prologika.com/how-to-test-ssrs-mdx-queries-in-sql-server-management-studio/
Any idea what the problem might be?
回答1:
Are you really using this in your member names? .&;[
....the semi-colon is reserved for the end of mdx
statements. Please take out all the semi-colons:
SELECT
{
[Measures].[Broj Pristapi]
,[Measures].[Broj Nalozi]
} ON 0
,
Except
(
StrToSet("{[Dim Ucesnici].[Naziv Ucesnik].&[owiefwjhoef]}")
,{
[Dim Ucesnici].[Naziv Ucesnik].&[kihebrgk]
,[Dim Ucesnici].[Name].&[blablabla]
}
)*
StrToSet
("{ [Dim Web Service Web Method].[Web Service].&[wsINAPBan],
[Dim Web Service Web Method].[Web Service].&[wsNAPSBan] }"
)*
StrToSet
("{ [Dim Web Service Web Method].[Web Method].[All]
,[Dim Web Service Web Method].[Web Method].&[funNN_loadPP30Ban]
,[Dim Web Service Web Method].[Web Method].&[funNN_loadPP50Ban]}"
)*
{
StrToMember("[Dim Datumi].[Datum ID].&[20170801]")
:
StrToMember("[Dim Datumi].[Datum ID].&[20170906]")
}*
StrToSet("[Dim Ucesnici].[Opis Tip Ucesnik].&[Bank]") ON 1
,NON EMPTY
{
[Dim Date].[Date].Children*
[Dim Date].[Month].Children*
[Dim Date].[MonthName].Children
} ON 2
FROM [DW];
来源:https://stackoverflow.com/questions/46077016/testing-mdx-query-with-parameters-in-ssas