How can remove the null values?

一个人想着一个人 提交于 2019-12-13 14:21:50

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/15788528/how-can-remove-the-null-values

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!