How can remove the null values?

2019-07-05 01:54发布

How can I remove the null values in the bottomcount, ie. i only want to see the products with actually sold units, I have tried with nonempty and non empty without success.

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

标签: null ssas mdx
1条回答
冷血范
2楼-- · 2019-07-05 02:19

You could filter [Product].Members using NOT ISEMPTY() to exclude all the empty values, and then bottomcount the filtered set.

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]

Note that BottomCount() will do an ascending, break-hierarchies sort, so you need to do the Order() on top of it if you want descending order.

查看更多
登录 后发表回答