Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can remove the null values?

Tags:

null

ssas

mdx

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
like image 988
daniel_aren Avatar asked Aug 07 '26 09:08

daniel_aren


1 Answers

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.

like image 166
findango Avatar answered Aug 10 '26 10:08

findango



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!