如何从MDX查询结果中删除空行

时间:2018-11-27 18:49:47

标签: powerbi mdx mdx-query

如何从MDX查询结果中删除空行?

这是我目前正在使用的查询

    select
    non empty 
    {
[Measures].[Average Trips Per Day]
,[Measures].[Calories Burned]
,[Measures].[Carbon Offset]
,[Measures].[Median Distance]
,[Measures].[Median Duration]
,[Measures].[Rider Trips]
,[Measures].[Rides Per Bike Per Day]
,[Measures].[Total Distance]
,[Measures].[Total Riders]
,[Measures].[Total Trip Duration in Minutes]
,[Measures].[Total Members]
    } on columns
    ,
    non empty 
    {
    (
    [Promotion].[Promotion Code Name].children
)
    } on rows 
from [BCycle]
where ([Program].[Program Name].&[Madison B-cycle])

; results

1 个答案:

答案 0 :(得分:0)

这不是一个空值,但它是[Promotion]。[Promotion Code Name] .Children的子代之一。

您可以使用MDx的EXCEPT关键字从子级中排除该特定值。

查询示例:

   //This query shows the number of orders for all products,  
   //with the exception of Components, which are not  
   //sold.  
SELECT   
   [Date].[Month of Year].Children  ON COLUMNS,  
   Except  
      ([Product].[Product Categories].[All].Children ,  
         {[Product].[Product Categories].[Components]}  
      ) ON ROWS  
FROM  
   [Adventure Works]  
WHERE  
   ([Measures].[Order Quantity])  

参考-> https://docs.microsoft.com/en-us/sql/mdx/except-mdx-function?view=sql-server-2017