SSAS MDX Error: Two sets specified in the function have different dimensionality + Solution

when we run the below mdx query

WITH SET LastSample AS TAIL(NONEMPTY([Date].[Hierarchy].members *[Time].[Hierarchy].members,[Measures].[Overall LU SR]))
MEMBER [KPI Name] AS "Overall LU"
MEMBER [KPI Value] As KPIValue("Overall LU SR")
MEMBER [KPI Status] AS KPIStatus("Overall LU SR")
MEMBER ObjectName as "Overall LU SR"
MEMBER [Critical Threshold] as [KPI Thresholds].[Threshold1].&[Overall LU SR].member_value
MEMBER [Major Threshold] AS [KPI Thresholds].[Threshold2].&[Overall LU SR].member_value
MEMBER [Minor Threshold] AS 0
MEMBER latestDate as [Date].[Hierarchy].membervalue, format_string = 'mm/dd/YYYY'
MEMBER latestTime as [Time].[Hierarchy].member_caption
SELECT {latestDate,latestTime,ObjectName,[KPI Name], [KPI Value],[KPI Status],[Measures].[Critical Threshold],[Measures].[Major Threshold],[Measures].[Minor Threshold]} ON COLUMNS
,nonempty(LastSample) ON ROWS
FROM [DRA]

we got the below error
Executing the query ...
Query (11, 9) Two sets specified in the  function have different dimensionality.

Execution complete 
This error is misleading us ,  where are 2 Set s?   Then after many trail and error methods we identified there is problem with  MEMBER [KPI Name]  . The strange thing is  when we change the name of the member it is working fine  but it is not working with [KPI Name] but we need that name .
The final solution is we added Measures dimension to the name while selecting .

WITH SET LastSample AS TAIL(NONEMPTY([Date].[Hierarchy].members *[Time].[Hierarchy].members,[Measures].[Overall LU SR]))
MEMBER [KPI Name] AS "Overall LU"
MEMBER [KPI Value] As KPIValue("Overall LU SR")
MEMBER [KPI Status] AS KPIStatus("Overall LU SR")
MEMBER ObjectName as "Overall LU SR"
MEMBER [Critical Threshold] as  [KPI Thresholds].[Threshold1].&[Overall LU SR].member_value
MEMBER [Major Threshold] AS  [KPI Thresholds].[Threshold2].&[Overall LU SR].member_value
MEMBER [Minor Threshold] AS 0
MEMBER latestDate as [Date].[Hierarchy].membervalue, format_string = 'mm/dd/YYYY'
MEMBER latestTime as [Time].[Hierarchy].member_caption
SELECT  {latestDate,latestTime,ObjectName,[Measures].[KPI Name], [KPI Value],[KPI Status],[Measures].[Critical Threshold],[Measures].[Major Threshold],[Measures].[Minor Threshold]} ON COLUMNS
,nonempty(LastSample) ON ROWS
FROM [DRA]

Comments

Popular posts from this blog

SSAS : A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running. (Microsoft.AnalysisServices.AdomdClient). + Solution

SSIS Error : Unable to infer the XSD from the XML file. The XML contains multiple namespaces