MDX语言中的Filter

<Dimension foreignKey="EMPLOYEE_ID" name="Employee">
<Hierarchy hasAll="true" primaryKey="EMPLOYEE_ID">
<Table name="TB_EMPLOYEE" schema="MYORACLE">
</Table>
<Level name="employeeId" column="EMPLOYEE_ID" 

nameColumn="EMPLOYEE_NAME" type="String" uniqueMembers="true" levelType="Regular" 

hideMemberIf="Never">
<Property name="IsNew" column="EMPLOYEE_NEW" 

type="Numeric">

</Property>
</Level>
</Hierarchy>
</Dimension>

前面是一个Employee维度的定义(后面还会用到Measure Salary,就是薪水这个Measure,定义就不在这里贴出来了),注意里面有IsNew属性的定义,IsNew有两个值,0和1。现在我需要通过IsNew来进行自定义显示,需要的时候显示0,或1或0,1。

MDX查询
(1)显示IsNew属性值 大于等于0 的[Employee]成员
select Measures.Salary on columns,
filter( { [Employee].[All Employees].Children } , [Employee].CurrentMember.Properties("IsNew") >= 0 ) on rows from Cube
结果:
Axis #0:
{}
Axis #1:
{[Measures].[Salary]}
Axis #2:
{[Employee].[All Employees].[张三]}
{[Employee].[All Employees].[李四]}
{[Employee].[All Employees].[王五]}
Row #0: 3,300
Row #1: 1,500
Row #2: 6,000

(2)显示IsNew属性值等于0的[Employee]成员
select Measures.Salary on columns, 
filter( { [Employee].[All Employees].Children } , [Employee].CurrentMember.Properties("IsNew") = 0 ) on rows from Cube
结果:
Axis #0:
{}
Axis #1:
{[Measures].[Salary]}
Axis #2:
{[Employee].[All Employees].[张三]}
{[Employee].[All Employees].[李四]}
Row #0: 3,300
Row #1: 1,500

转载于:https://www.cnblogs.com/iammatthew/archive/2010/08/19/1803903.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值