SSAS MDX 查询中的多维度条件不起作用
我的 SSAS
多维数据集中有以下数据。
我的需要是使用
MDX
根据具有两个不同维度的两个条件获取度量值。
在此示例数据中,我需要获取
经销商销售额
值,其中Title
维度的值等于销售代表并且Gender
维度的值等于Male条件。
我尝试使用 Case 语句和 IIF() 函数在 MDX
中可用,但不起作用。
请查找我尝试过使用不同功能的查询。
使用 Case 语句:
WITH MEMBER [Measures].[Expression1] AS
CASE WHEN [Employee].[Title].CURRENTMEMBER.MEMBERVALUE = "Sales Representative" THEN (CASE
WHEN [Employee].[Gender].CURRENTMEMBER.MEMBERVALUE = "Male"
THEN [Measures].[Reseller Sales Amount] ELSE 0 END)ELSE 0 END select [Measures].[Expression1] on Columns from [Sales Targets]
使用 IIF() 函数:
WITH MEMBER [Measures].[Expression1] AS
IIF( [Employee].[Title].CURRENTMEMBER.MEMBERVALUE = "Sales Representative" AND [Employee].[Gender].CURRENTMEMBER.MEMBERVALUE = "Male",
[Measures].[Reseller Sales Amount], 0)
SELECT{
[Measures].[Expression1]} ON COLUMNS FROM [Sales Targets] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORMAT_STRING
我得到的两个查询的结果都是 0。
任何人都可以指导我使用
MDX
获得正确的结果吗?
I Am having the following data in my SSAS
cube.
My need is to get the value of the measure based on two conditions with two different dimensions using the
MDX
.
In this example data, I need to get the
Reseller Sales Amount
value where the value ofTitle
dimension is equal to Sales Representative and the value of theGender
dimension is equal to Male condition.
I have tried to achieve the requirement with the Case statement and IIF() function available in the MDX
but it is not working.
Please find the queries I have tried with different functions.
Using Case statement:
WITH MEMBER [Measures].[Expression1] AS
CASE WHEN [Employee].[Title].CURRENTMEMBER.MEMBERVALUE = "Sales Representative" THEN (CASE
WHEN [Employee].[Gender].CURRENTMEMBER.MEMBERVALUE = "Male"
THEN [Measures].[Reseller Sales Amount] ELSE 0 END)ELSE 0 END select [Measures].[Expression1] on Columns from [Sales Targets]
Using IIF() function:
WITH MEMBER [Measures].[Expression1] AS
IIF( [Employee].[Title].CURRENTMEMBER.MEMBERVALUE = "Sales Representative" AND [Employee].[Gender].CURRENTMEMBER.MEMBERVALUE = "Male",
[Measures].[Reseller Sales Amount], 0)
SELECT{
[Measures].[Expression1]} ON COLUMNS FROM [Sales Targets] CELL PROPERTIES VALUE, FORMATTED_VALUE, FORMAT_STRING
The result that I am getting for both queries is 0.
Can anyone please guide me to get the proper result using
MDX
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 元组< /a> 直接在计算的度量中:
或者如果您希望它应用于查询中的所有单元格,您可以将元组放在 where 子句中:
You can use a Tuple either directly in the calculated measure:
Or you can put a Tuple in the where clause if you want it to apply to all cells in the query: