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];
时间: 2024-10-31 19:26:38