
MDX 查询原型
查询 2004 年 1 月 2 日 - 2004 年 3 月 1 日之间购买过 Bikes 产品的用户。
发布日期:2025-04-13 13:01:19
浏览次数:11
分类:精选文章
本文共 1689 字,大约阅读时间需要 5 分钟。
记录 SBS 中 MDX 查询原型,供实际项目参考。
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])
- 查询 2004 年 1 月 2 日 - 2004 年 3 月 1 日之间购买过 Bikes 或 Clothing 产品的用户。
- 计算 2004 年 3 月 1 日 - 3 月 4 日之前 60 天购买了 Bikes 或 Clothing 产品的用户数量。
- 计算每个月第一天到前 60 天购买了 Bikes 或 Clothing 产品的用户数量。
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])
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)) )
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 文章请参看相关链接。
发表评论
最新留言
第一次来,支持一个
[***.219.124.196]2025年04月29日 07时13分49秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
MapReduce程序(一)——wordCount
2025-04-12
MapReduce编程模型简介和总结
2025-04-12
MapReduce:大数据处理的范式
2025-04-12
MapStruct 对象间属性复制
2025-04-12
MapStruct 映射过程中忽略某个字段
2025-04-12
MapStruct 超神进阶用法,让你的代码效率提升十倍!
2025-04-12
MapStruct使用工具类中的方法来映射字段
2025-04-12
MapStruct的使用教程
2025-04-12
MapXtreme 2005 学习心得 一些基础函数代码(四)
2025-04-12
Map中key和value值是否可以为null或空字符串?
2025-04-12
map函数
2025-04-12
map反转key value
2025-04-12
map和bean的相互转换
2025-04-12
map和filter使用方法与区别
2025-04-12
Map和Set
2025-04-12
map和weakMap的区别
2025-04-12
Map如何获取所有value的值
2025-04-12
Map存入的数据丢失类型任意
2025-04-12
Map排序
2025-04-12
map格式和string格式转化为json格式
2025-04-12