嵌套度量中的总计计算不正确

问题描述 投票:0回答:1

我有以下措施计算错误

SummerizeConsumption = 
VAR _Table = SUMMARIZE('Chips Consuption Query','Chips Consuption Query'[Component.Component Level 01.Key])
RETURN SUMX(_Table,[Consumption])

这里是[消耗]的衡量公式

[Consumption]=
var Val1 = CALCULATE(SUMX(
    VALUES('Parent Consumption Query'[Component.Component Level 01.Key]), IF('Parent Consumption Query'[Component.Component Level 01.Key] IN { "P1","P2","P3","P4","P5" }, 'Parent Consumption Query'[Parent Issue Stock Qty.]) ))
    
   var val2 = CALCULATE(SUMX(
    VALUES('Parent Production Query'[Material.Material Level 01.Key]), IF('Parent Production Query'[Material.Material Level 01.Key] IN { "P1","P2","P3","P4","P5" }, 'Parent Production Query'[Parent Production Qty.]) ))

RETURN DIVIDE(Val1,val2)

 
'Parent Consumption Query'[Parent Issue Stock Qty.]= SUM('Parent Consumption Query'[Issue Total Stock])  
'Parent Production Query'[Parent Production Qty.] =SUM('Parent Production Query'[Activity quantity])

我的问题是 SummerizeConspiration 未正确计算总计,如下所示

powerbi dax
1个回答
0
投票

我认为你的上下文有问题。我看到 SummerizeConspiration 度量聚合了汇总表中的数据,但随后在其中应用了 [Conspiration] 度量。 如果 [Consumation] 依赖于 _Table 中未保留的上下文,则可能会导致不正确的结果。

SummerizeConclusion 中的 SUMX 迭代 _Table,但 [Conspiration] 度量涉及通过 CALCULATE 进行上下文转换,由于缺乏原始表的上下文,这可能不会按预期运行。

VAR _Table = SUMMARIZE(
    'Chips Consuption Query',
    'Chips Consuption Query'[Component.Component Level 01.Key],
    "Consumption", [Consumption] 
)
RETURN SUMX(_Table, [Consumption])
© www.soinside.com 2019 - 2024. All rights reserved.