以下脚本旨在返回三个字段:
1的地区
2. 收入
3. %父母 ...我们的地理维度的结构这将是该地区的收入占各大洲收入的百分比。
WITH
MEMBER Measures.[%Parent] AS
[Measures].currentmember/
(
[Geolocation].[Geography].currentmember.parent.name,
[Measures].currentmember
), format_string ="Percent"
SELECT
ORDER(
DESCENDANTS(
[Geolocation].[Geography].[All],
[Geolocation].[Geography].[Geography Region]
),
[Geolocation].[Geography].CurrentMember.name,
BASC
) ON ROWS,
{[Measures].[Revenue], Measures.[%Parent]} ON COLUMNS
FROM [MyCube]
目前它返回以下内容。如何更改脚本以获得我想要的百分比?
答案 0 :(得分:2)
我认为[Measures].CurrentMember
可能是错误的 - 它指的是计算成员。请明确指出该措施:
WITH MEMBER [Measures].[%Parent] AS
[Measures].[Internet Order Quantity] /
([Customer].[Customer Geography].CurrentMember.Parent, [Measures].[Internet Order Quantity])
, format_string ="Percent"
SELECT
{[Measures].[Internet Order Quantity], [Measures].[%Parent]} ON 0,
DrillDownLevel([Customer].[Customer Geography].[All Customers]) ON 1
FROM [Adventure Works]
结果:
Internet Order Quantity %Parent
All Customers 60,398 1.#INF
Australia 13,345 22.10%
Canada 7,620 12.62%
France 5,558 9.20%
Germany 5,625 9.31%
United Kingdom 6,906 11.43%
United States 21,344 35.34%
(当然我的快速示例并没有为All会员提供保护,但你明白了。)