Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Hope you are fine. I am facing an issue in MDX Query. I have a custom MDX query, When I run the query I am getting results too. Now my requirement is to show the dimension names in the query result, So that I can get those header names in the cell set itself. Please see the below image.

https://social.msdn.microsoft.com/Forums/getfile/738888[^]

In this image I need to show 'Fiscal Year' and 'Fiscal Quarter' in that highlighted area. Is there any custom query for this? Please share me any sample if you have such a one. Thanks a lot in advance.

Kindest Regards
Sibeesh Venu
sibeeshpassion.com[^]
Posted

1 solution

Please try like this:
SQL
 WITH 
       MEMBER [Measures].[Fiscal Year] AS [Dim Data Period].[Fiscal Year].CURRENTMEMBER.MEMBER_CAPTION
       MEMBER [Measures].[Fiscal Quarter] AS [Dim Data Period].[Fiscal Quarter].CURRENTMEMBER.MEMBER_CAPTION

SELECT 
       NONEMPTY(
                     {
                        [Measures].[Fiscal Year]
                        ,[Measures].[Fiscal Quarter]
                        ,[Measures].[Net Sales]
                        ,[Measures].[MaxRowCount]
                     }
				 ) ON COLUMNS
	  ,NONEMPTY(
					 { [Dim Data Period].[Fiscal Year].[ALL].CHILDREN }
					,{ [Dim Data Period].[Fiscal Quarter].[ALL].CHILDREN }
                                        // add any other info you might have

			   ) ON ROWS

FROM [Your Cube]
//WHERE 
//         (
//             [Dim Data Period].[Fiscal Year].&[FY15]
//         )
//


Thanks,

Kuthuparakkal
 
Share this answer
 
Comments
Sibeesh Passion 30-Oct-15 1:16am    
Thanks a lot for your reply, But when I run the given query, it throws an error as "Query (14, 8) The dimension '[Dim Data Period]' was not found in the cube when the string, [Dim Data Period].[Fiscal Year].[ALL], was parsed."
Kuthuparakkal 30-Oct-15 8:51am    
[Dim Data Period] may not be your dim name - change it (commonsense !? )
Sibeesh Passion 30-Oct-15 9:00am    
OMG, I got it. Sorry, will check the query with the updated information and let you know. Thank you
Kuthuparakkal 30-Oct-15 15:47pm    
If it worked, mark as answer!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900