testing mdx query with parameters in SSAS

杀马特。学长 韩版系。学妹 提交于 2021-02-10 05:48:20

问题


I'd like to test a MDX query in SSAS. I did the following steps until now.

  1. I opened the SQL Profiler and ran the SSRS report
  2. I found the query I needed (with parameter values) and selected it sql profiler
  3. I pasted the code in ssas
  4. 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];
  1. 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

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