空单元格的使用

类别:数据库 点击:0 评论:0 推荐:

使用MDX数值函数如avg、count等的时候,通常会忽略空单元格!唯一的例外是count函数。它提供了INCLUDEEMPTY
参数,指明是否包括空单元格。
1:NON EMPTY关键字
一般使用在轴级别。
select
    {[Measures].[Store Sales]} on columns,
    NON EMPTY {[time2].[所有 time2].[1997].[Q4].[10].children} on rows
from Sales
显示1997年10月每日非空的销售。
无NON EMPTY关键字则显示所有销售。
2:count
10月销售日计数(无论有无销售)
with member [time2].[销售日] as 'count([time2].[所有 time2].[1997].[Q4].[10].children)'
select
   {[Measures].[Store Sales]} on columns,
    {[time2].[销售日]} on rows
from Sales

10月销售日计数(仅包括有销售日期)
with member [time2].[销售日] as 'count([time2].[所有 time2].[1997].[Q4].[10].children,
ExcludeEmpty)'
3:sum和avg等函数
这些函数对于空单元,则忽略!(不转换为0)

 

 

本文地址:http://com.8s8s.com/it/it20609.htm