如何删除空值?

时间:2013-04-03 13:21:34

标签: null ssas mdx

如何删除bottomcount中的空值,即。我只想看看实际销售单位的产品,我尝试过非空而非空,但没有成功。

with
member [Measures].[Amount Sold] as
    ([Measures].[Internet Sales Amount]),
format_string = "currency"

select {[Measures].[Amount Sold]}
on columns,
bottomcount(
order(

{[Product].[Product].Members},
([Measures].[Amount Sold]), bdesc),
5 )on rows

1 个答案:

答案 0 :(得分:3)

您可以过滤[产品]。使用NOT ISEMPTY()成员排除所有空值,然后将过滤后的数据集底部计算。

with member [Measures].[Amount Sold] as
    ([Measures].[Internet Sales Amount]),
    format_string = "currency"
select 
    {[Measures].[Amount Sold]} on columns,
    order(
        bottomcount(
            filter({[Product].[Product].Members}, NOT ISEMPTY([Measures].[Amount Sold])),
            5,
            [Measures].[Amount Sold]),
        [Measures].[Amount Sold], bdesc) on rows
from [Adventure Works]

请注意,BottomCount()将执行升序,中断层次结构排序,因此如果您想降序,则需要在其上执行Order()