You need to enable JavaScript to run this app. MDX计算PanelSoldMonths时简单除法返回空值问题求助
优惠活动
大模型
产品
解决方案
定价
更多

MDX计算PanelSoldMonths时简单除法返回空值问题求助

问题原因

你编写的MDX语句出现空值是因为对维度属性的引用方式错误:

  • IIF判断条件中直接写[In Charge Date].[In Charge Date Days in Month]= 0无法获取到当前行对应月份的实际天数属性值
  • 除法分母写[In Charge Date].[In Charge Date Days in Month].Children返回的是该属性的所有成员集合,不是当前行对应成员的数值,所以运算失败返回空值

修正方案

使用CurrentMember.MemberValue获取当前行对应维度成员的实际数值,再做除法运算,修正后的MDX语句如下:

WITH MEMBER [Measures].PanelSoldMonths AS 
IIF ([In Charge Date].[In Charge Date Days in Month].CurrentMember.MemberValue = 0, NULL,
     [Measures].[Panel Sold Days] / [In Charge Date].[In Charge Date Days in Month].CurrentMember.MemberValue)
SELECT 
{[Measures].[Total Net Net Revenue], [Measures].[Panel Sold Days], [Measures].PanelSoldMonths}
ON COLUMNS, 
NON EMPTY
([In Charge Date].[In Charge Year].Children,  [In Charge Date].[In Charge Date Days in Month].Children)
ON ROWS
FROM [Combined Sales]
WHERE [Asset Info].[Format Group L2].&[Digital] 

如果维度属性的MemberValue没有正确绑定数值,也可以替换为[In Charge Date].[In Charge Date Days in Month].CurrentMember.Properties("In Charge Date Days in Month")来读取属性值。

内容的提问来源于stack exchange,提问作者Shoaib Maroof

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.20 08:06:09