博客
关于我
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中的四大运算符种类汇总20多项,用了三天三夜来整理的,还不赶快收藏
    查看>>
    mysql中的字段如何选择合适的数据类型呢?
    查看>>
    MySQL中的字符集陷阱:为何避免使用UTF-8
    查看>>
    mysql中的数据导入与导出
    查看>>
    MySQL中的时间函数
    查看>>
    mysql中的约束
    查看>>
    MySQL中的表是什么?
    查看>>
    mysql中穿件函数时候delimiter的用法
    查看>>
    Mysql中索引的分类、增删改查与存储引擎对应关系
    查看>>
    Mysql中索引的最左前缀原则图文剖析(全)
    查看>>
    MySql中给视图添加注释怎么添加_默认不支持_可以这样取巧---MySql工作笔记002
    查看>>
    Mysql中获取所有表名以及表名带时间字符串使用BetweenAnd筛选区间范围
    查看>>
    Mysql中视图的使用以及常见运算符的使用示例和优先级
    查看>>
    Mysql中触发器的使用示例
    查看>>
    Mysql中设置只允许指定ip能连接访问(可视化工具的方式)
    查看>>
    mysql中还有窗口函数?这是什么东西?
    查看>>
    mysql中间件
    查看>>
    MYSQL中频繁的乱码问题终极解决
    查看>>
    MySQL为Null会导致5个问题,个个致命!
    查看>>
    MySQL为什么不建议使用delete删除数据?
    查看>>