码迷,mamicode.com
首页 > 其他好文 > 详细

datazen&MDX学习笔记

时间:2016-04-04 09:07:42      阅读:367      评论:0      收藏:0      [点我收藏+]

标签:

1. 得到当前时间例子

with member thismonth as format(dateadd(‘d‘,-1,now()),‘yyyyMM‘)
select 
{
[Measures].[销售成本],
[Measures].[销售金额],
[Measures].[销售利润]
}
on 0,
non empty{
[Dim Product].[SEASON KEY].children*
[Dim Product].[PRICETIER KEY].children*
[Dim Shop].[AREA].children*
[Dim Shop].[SHOP].children
} on 1
from [HxDataWarehouse]
where strtoset(‘([Dim Date].[Calendar].[MONTH KEY].&[‘+thismonth+‘])‘)

2. DATAZEN时间参数传递。这里datazen时间的处理还是有问题,应该会有更好的方式,暂时没时间研究。

with member sstartdate as left(‘{{ @startdate }}‘,10)
member senddate as left(‘{{ @enddate }}‘,10)
member tstartdate as str(year(sstartdate))+right("0"+str(month(sstartdate)),2)+right("0"+str(day(sstartdate)),2)
member tenddate as str(year(senddate))+right("0"+str(month(senddate)),2)+right("0"+str(day(senddate)),2)
select 
{
[Measures].[销售成本],
[Measures].[销售金额],
[Measures].[销售利润]
}
on 0,
non empty{
[Dim Product].[商品属性].children*
[Dim Shop].[SHOP].children
} on 1
from [HxDataWarehouse]
where 
strtoset(‘([Dim Date].[DATE KEY].&[‘+tstartdate+‘]:[Dim Date].[DATE KEY].&[‘+tenddate+‘])‘)

3. 同时把keycolumn和namecolumn查出来。

 

select
    [Measures].[销售金额] on 0, 
non empty{[Dim Shop].[AREA].children } DIMENSION PROPERTIES MEMBER_KEY on 1
from 
[HxDataWarehouse]

 

WITH
MEMBER [Measures].[Parent Member Name] AS
[Product].[Product Categories].CurrentMember.Properties("LEVEL_NUMBER") 

SELECT
{([Measures].[Parent Member Name])} ON COLUMNS,
{[Product].[Product Categories].AllMembers} ON ROWS
FROM [Step-by-Step];

 

datazen&MDX学习笔记

标签:

原文地址:http://www.cnblogs.com/cainiao116/p/5351359.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!