博客
关于我
MDX 查询原型
阅读量:802 次
发布时间:2023-02-08

本文共 1670 字,大约阅读时间需要 5 分钟。

记录 SBS 中 MDX 查询原型,供实际项目参考。

  • 查询 2004 年 1 月 2 日 - 2004 年 3 月 1 日之间购买过 Bikes 产品的用户。
  • SELECT ([Product].[Category].[Bikes],[Measures].[Internet Sales Amount]) ON COLUMNS,NON EMPTY [Customer].[Customer].[Customer].MEMBERS ON ROWSFROM [Step-by-Step]WHERE ([Date].[Calendar].[Date].&[20040102]:[Date].[Calendar].[Date].&[20040301])
    1. 查询 2004 年 1 月 2 日 - 2004 年 3 月 1 日之间购买过 Bikes 或 Clothing 产品的用户。
    2. SELECT ({([Product].[Category].[Bikes],[Measures].[Internet Sales Amount]),([Product].[Category].[Clothing],[Measures].[Internet Sales Amount])} ON COLUMNS,NON EMPTY [Customer].[Customer].[Customer].MEMBERS ON ROWSFROM (    SELECT ([Date].[Calendar].[Date].&[20040102]:[Date].[Calendar].[Date].&[20040301]) ON COLUMNS    FROM [Step-by-Step])
      1. 计算 2004 年 3 月 1 日 - 3 月 4 日之前 60 天购买了 Bikes 或 Clothing 产品的用户数量。
      2. WITH MEMBER [Measures].[CustomerCounts] ASCOUNT(NONEMPTY ({[Customer].[Customer].[Customer].MEMBERS},{([Product].[Category].[Bikes],[Measures].[Internet Sales Amount])}* LASTPERIODS(60,[Date].[Calendar].CurrentMember)) + NONEMPTY ({[Customer].[Customer].[Customer].MEMBERS},{([Product].[Category].[Clothing],[Measures].[Internet Sales Amount])}* LASTPERIODS(60,[Date].[Calendar].CurrentMember)) )
        1. 计算每个月第一天到前 60 天购买了 Bikes 或 Clothing 产品的用户数量。
        2. WITH MEMBER [Measures].[CustomerCounts] ASCOUNT(NONEMPTY ({[Customer].[Customer].[Customer].MEMBERS},{([Product].[Category].[Bikes],[Measures].[Internet Sales Amount])}* LASTPERIODS(60,[Date].[Calendar].CurrentMember.FIRSTCHILD)) + NONEMPTY ({[Customer].[Customer].[Customer].MEMBERS},{([Product].[Category].[Clothing],[Measures].[Internet Sales Amount])}* LASTPERIODS(60,[Date].[Calendar].CurrentMember.FIRSTCHILD)) )

          更多 BI 文章请参看相关链接。

    转载地址:http://omyfk.baihongyu.com/

    你可能感兴趣的文章
    MySQL 导出数据
    查看>>
    mysql 将null转代为0
    查看>>
    mysql 常用
    查看>>
    MySQL 常用列类型
    查看>>
    mysql 常用命令
    查看>>
    Mysql 常见ALTER TABLE操作
    查看>>
    MySQL 常见的 9 种优化方法
    查看>>
    MySQL 常见的开放性问题
    查看>>
    Mysql 常见错误
    查看>>
    mysql 常见问题
    查看>>
    MYSQL 幻读(Phantom Problem)不可重复读
    查看>>
    mysql 往字段后面加字符串
    查看>>
    mysql 快照读 幻读_innodb当前读 与 快照读 and rr级别是否真正避免了幻读
    查看>>
    MySQL 快速创建千万级测试数据
    查看>>
    mysql 快速自增假数据, 新增假数据,mysql自增假数据
    查看>>
    MySql 手动执行主从备份
    查看>>
    Mysql 批量修改四种方式效率对比(一)
    查看>>
    Mysql 报错 Field 'id' doesn't have a default value
    查看>>
    MySQL 报错:Duplicate entry 'xxx' for key 'UNIQ_XXXX'
    查看>>
    Mysql 拼接多个字段作为查询条件查询方法
    查看>>