I have a view against a OPENQUERY() which gets data from a SSAS cube. MDX query looks like this:
WITH MEMBER [Measures].[Measure1] AS
(--calculation)
SELECT
{[Measures].[Measure1]}
ON 0,
NON EMPTY ([Dim1].[Dim_key].[Dim_key], [Dim2].[Dim_key].[Dim_key])
ON 1
FROM [Cube]
WHERE ([Dim3].[Hierarchy].[Level].[Member])
My problem is that when the WHERE filter results in 0 rows the view does not work, with error:
Invalid column name '[Dim1].[Dim_key].[Dim_key].[MEMBER_CAPTION]'.
Since its using the column name to have a GROUP BY
How can I force it return at least one row? Or always return the column names? I cannot remove the NON EMPTY since whole set takes about 1 min to load.
So far I've tried these solutions:
MDX - Always return at least one row even if no data is available
Force mdx query to return column names
but it seems like it does not work since I have a where condition on another dimension.