?
Solved

Dynamic MDX problem in SSRS2005

Posted on 2010-09-01
4
Medium Priority
?
1,127 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 2000 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

800 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