本文介绍了MDX-即使没有可用数据,也总是返回至少一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下MDX提取参数:
I am using the following MDX to pull a parameter:
WITH
MEMBER [Measures].[Label] AS [Dim].[Hier].CURRENTMEMBER.NAME
MEMBER [Measures].[Value] AS [Dim].[Hier].CURRENTMEMBER.UNIQUENAME
SELECT
{
[Measures].[Label]
, [Measures].[Value]
}
ON 0,
NONEMPTY([Dim].[Hier].children, [Measures].[Measure])
ON 1
FROM [Cube]
WHERE
(
-- Criteria
)
有时候,选择某些过滤准则时,查询结果在空集.相反,我希望它在值和标签上都显示"N/A".是否可以在MDX中使用?还是应该使用SSRS Calculated成员对结果数据集中的行进行计数并进行替换?
Sometimes, when selecting certain filtering criteria the query results in empty set. Instead, I would like it to display "N/A" in both value and label. Is it doable in MDX or should I use SSRS Calculated member to count rows in resulting dataset and substitute?
推荐答案
类似的东西:
WITH
SET [MySet] AS NONEMPTY([Dim].[Hier].children, [Measures].[Measure])
MEMBER [Measures].[Label] AS [Dim].[Hier].CURRENTMEMBER.NAME
MEMBER [Measures].[Value] AS [Dim].[Hier].CURRENTMEMBER.UNIQUENAME
MEMBER [Dim].[Hier].[All(likely)].[N/A] AS 'N/A'
SELECT
{[Measures].[Label] , [Measures].[Value] }
ON 0,
IIF( count( [MySet] ) = 0, {[Dim].[Hier].[All(likely)].[N/A]}, [MySet] )
ON 1
FROM
[Cube]
WHERE
(-- Criteria)
这篇关于MDX-即使没有可用数据,也总是返回至少一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!