我有一个MDX查询工作,它让我在一个日期范围内衡量一些国家/地区。 但是如果我将日期范围设置为超过1天,我会得到每个国家/地区的价值(在该范围内)。 但我想总结一下这个日期范围内每个国家的措施。 提前致谢。没有找到一个令人兴奋的话题;)
查询(由于实习数据,某些部分被划掉),标记为“???”:
ls_value=string(dw_blood.getitemstring(ll_currentrow, "name"))
ls_find="fname like '"+ls_value+"%'"
dw_employee.setfilter(ls_find)
dw_employee.filter()
这是输出: http://image.prntscr.com/image/ab236e90880a4d8b969fdd182a05ccdb.png
但我想这样: 德国901 奥地利67
等
答案 0 :(得分:0)
我重新格式化了你的代码,试着让它更具可读性 - 这部分代码看起来不正确:
SET [*SORTED_ROW_AXIS] AS
'ORDER(
[*CJ_ROW_AXIS]
,ANCESTOR(
[Time.GA Date Hierarchy].CURRENTMEMBER
, [Time.GA Date Hierarchy].[Year]).ORDERKEY
,BASC
,ANCESTOR(
[Time.GA Date Hierarchy].CURRENTMEMBER
, [Time.GA Date Hierarchy].[Month]).ORDERKEY
,BASC
,[Time.GA Date Hierarchy].CURRENTMEMBER.ORDERKEY
,BASC
,[Measures].[*SORTED_MEASURE]
,BASC)'
尝试简化整个脚本我已经得到以下内容 - 我将回到此处,因为它无法解决您的问题,但我只想尝试了解发生了什么:
WITH
SET [*NATIVE_CJ_SET] AS
NONEMPTY(
[Site.Site Hierarchy].[???]
* [Time.GA Date Hierarchy].[2016].[8].[1] : [Time.GA Date Hierarchy].[2016].[8].[11]
* {
[Country.Country Hierarchy].[Austria]
,[Country.Country Hierarchy].[Germany]
,[Country.Country Hierarchy].[India]
,[Country.Country Hierarchy].[Switzerland]
,[Country.Country Hierarchy].[United States]
}
,[Measures].[???])
)
SET [*CJ_COL_AXIS] AS
GENERATE(
[*NATIVE_CJ_SET]
,{([Site.Site Hierarchy].CURRENTMEMBER)}
)
SET [*NATIVE_MEMBERS__Site.Site Hierarchy_] AS
GENERATE(
[*NATIVE_CJ_SET]
,{[Site.Site Hierarchy].CURRENTMEMBER}
)
SET [*SORTED_COL_AXIS] AS
ORDER(
[*CJ_COL_AXIS]
,[Site.Site Hierarchy].CURRENTMEMBER.ORDERKEY
,BASC
)
SET [*CJ_ROW_AXIS] AS
GENERATE(
[*NATIVE_CJ_SET]
,(
[Time.GA Date Hierarchy].CURRENTMEMBER
,[Country.Country Hierarchy].CURRENTMEMBER
)
)
MEMBER [Site.Site Hierarchy].[*TOTAL_MEMBER_SEL~SUM] AS
SUM(
[*NATIVE_MEMBERS__Site.Site Hierarchy_]
)
, SOLVE_ORDER=98
MEMBER [Measures].[*SORTED_MEASURE] AS
(
[Measures].[???]
,[Site.Site Hierarchy].[*TOTAL_MEMBER_SEL~SUM]
)
, SOLVE_ORDER=400
SET [*SORTED_ROW_AXIS] AS
ORDER(
[*CJ_ROW_AXIS]
,ANCESTOR(
[Time.GA Date Hierarchy].CURRENTMEMBER
, [Time.GA Date Hierarchy].[Year]).ORDERKEY
,BASC
,ANCESTOR(
[Time.GA Date Hierarchy].CURRENTMEMBER
, [Time.GA Date Hierarchy].[Month]).ORDERKEY
,BASC
,[Time.GA Date Hierarchy].CURRENTMEMBER.ORDERKEY
,BASC
,[Measures].[*SORTED_MEASURE]
,BASC)
SELECT
[*SORTED_COL_AXIS] * [Measures].[???] ON 0
,[*SORTED_ROW_AXIS] ON 1
FROM [???];
答案 1 :(得分:0)
好的,我明白了。 写了我自己的MDX,这要好得多:
SELECT CrossJoin([Site.Site Hierarchy].[???], {[Measures].[???]}) ON COLUMNS,
Order({[Country.Country Hierarchy].[Austria],[Country.Country Hierarchy].[Germany],[Country.Country Hierarchy].[India],[Country.Country Hierarchy].[Switzerland],[Country.Country Hierarchy].[United States]}, Measures.[sessions], BASC) ON ROWS
FROM [???]
WHERE {[Time.GA Date Hierarchy].[2016].[8].[1] : [Time.GA Date Hierarchy].[2016].[8].[17]}
但订单无效。有什么问题? 结果:http://www2.pic-upload.de/img/31482391/Screenshot_1.png