简体   繁体   English

使用MDX在Query Designer中筛选成员属性

[英]Filter member properties in Query Designer using MDX

How can I filter two member properties using MDX? 如何使用MDX过滤两个成员属性?

在此输入图像描述

Currently I have the following solution. 目前我有以下解决方案。 It works but I'm sure an MDX query would be much more efficient. 它可以工作,但我确信MDX查询会更有效率。

The Dataset in Query Designer has the following MDX to include the member properties as fields: 查询设计器中的数据集具有以下MDX以将成员属性包括为字段:

DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME, [Store].[Store].[Closed Date],[Store].[Store].[Opening Date]

I am using two filters in the Dataset Properties with the following expressions: 我在数据集属性中使用两个过滤器,其中包含以下表达式:

    =Cint(Fields!Opening_Date.Value) 
    < 
    =Cint(Format(Today(), "yyyyMMdd"))

and

    =Cint(Fields!Closed_Date.Value) 
    >
    =Cint(Format(Today(), "yyyyMMdd"))

I doubt performance of the below would be satisfactory, but you can give it a shot. 我怀疑下面的表现会令人满意,但你可以试一试。

SELECT SomeDim.SomeHIerarchy.MEMBER 
HAVING 
Val(SomeDim.SomeHIerarchy.CURRENTMEMBER.Properties("Opening Date")) <  Format(now(), "dd-MM-yyyy")
Val(SomeDim.SomeHIerarchy.CURRENTMEMBER.Properties("Closing Date")) > Format(now(), "dd-MM-yyyy")
ON 1,
Measures.Foo on 0
FROM [Your Cube]

I found that using a filter was the best way to solve this: 我发现使用过滤器是解决此问题的最佳方法:

filter(
  [Store].[Store].members, [Store].[Store].Properties( "Opening Date" ) < Format(Now(),'yyyyMMdd') 
  and [Store].[Store].Properties( "Closed Date" ) > Format(Now(),'yyyyMMdd'))
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM