Solved

Dynamic MDX problem in SSRS2005

Posted on 2010-09-01
4
1,122 Views
Last Modified: 2016-02-15
I have the following problem: I need to create dynamic mdx query to SSAS 2005 in SSRS 2005.
I'am creating dynamic mdx query with the help of embedded code ant it's ok. The code returns three dimensions and two measure columns. These three dimensions are being genenerated in my code dynamically. The problems begin when I need to assign column name in dataset. I can't make alias for returning dimensions like in SQL (select column as 'aaa'). I've tried to generate column name in dataset dynamically but unfortunately it didn't work.
Value for field assign in SSRS dataset for OLAP source loks like: <?xml version="1.0" encoding="utf-8"?><Field xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:type="Level" UniqueName="[Dim Dimension].[Dimension]" />. If i generate it in code and assign in dataset it doesn't work.
Another decision which I tried is to generate these columns through the following code:
with member Measures.RowGroup1 as [Dim Dimension1].[Dimension1].CurrentMember.Member_Caption
member Measures.RowGroup2 as [Dim Dimension2].[Dimension2].CurrentMember.Member_Caption
member Measures.RowGroup3 as [Dim Dimension3].[Dimension3].CurrentMember.Member_Caption
SELECT non empty
 {
      Measures.RowGroup1,
      Measures.RowGroup2,
      Measures.RowGroup3,
      [Measures].[Num]
      , [Measures].[Amt]
} ON COLUMNS
, non empty
(
      [Dim Dimension1].[Dimension1].[Dimension1].MEMBERS
      ,[Dim Dimension2].[Dimension2].[Dimension2].MEMBERS
      ,[Dim Dimension3].[Dimension3].[Dimension3].MEMBERS
  ) ON ROWS  .
When I use it for one dimension it's ok, but using all these measures together make mdx query running forever.
Does anyone know any solution for this problem?
0
Comment
Question by:JekaCh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Tim Humphries
ID: 33577699
Hi,

Are you generating a matrix report? If not, then rather than trying to return the column names in the query, can you not use similar logic to that used to build the query to dynamically change the column header names in the report layout?

So in your column headers you would call a function =Code.GetFirstColumnName etc.
I don't think you'll get far trying to get the column names back dynamically in your MDX, unless you used a third party tool such as Intelligencia maybe, but that costs £

Tim
0
 

Author Comment

by:JekaCh
ID: 33579285
Thanks for your comment, but the problem is not in creating column names in matrix report layout but in creating column definitions in dataset. Because as I described above in SSRS I unfortunately have to set  each column returning by query its name. And for OLAP source it seems can't be generated in code.
0
 
LVL 15

Accepted Solution

by:
Tim Humphries earned 500 total points
ID: 33582328
0
 

Author Comment

by:JekaCh
ID: 33590352
Thank you Tim this solution helped but I've earned new security problems because is seems that only user in sysadmin role could execute openrowset queries. Th following link helped me to solve this problem:
http://www.kodyaz.com/articles/enable-Ad-Hoc-Distributed-Queries.aspx
http://support.microsoft.com/kb/328569 - it works not just for SQL Server 2000 but for at least 2005 too.
0

Featured Post

Webinar: Choosing a MySQL HA Solution

Join Percona’s Principal Technical Services Engineer, Marcos Albe as he presents Choosing a MySQL High Availability Solution on Thursday, June 29, 2017 at 10:00 am PDT / 2:00 pm EDT (UTC-7).

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question