You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

DAX度量值空值判断失效:跨表币种取值问题排查

跨表币种取值DAX度量值问题排查与解决

原代码问题分析

  1. 无上下文筛选:原代码中MAXX('Budget','Budget'[Currency])直接取整张预算表的币种最大值,未针对当前行的Material no做筛选,无法匹配单个物料的对应币种。
  2. 语法错误:IF( ISBLANK(Purchase_filter)) || ...多了一个闭合括号,导致逻辑判断失效。

正确DAX实现(基于表关系)

前提:确保物料表与预算表、JIRA表通过Material no字段建立一对一关系(物料表为主表)。

Miara-test = 
VAR BudgetCurrency = RELATED('Budget'[Currency])
VAR JIRACurrency = RELATED(JIRA[Currency])
RETURN
    IF(
        NOT(ISBLANK(BudgetCurrency)) && BudgetCurrency <> "",
        BudgetCurrency,
        IF(
            NOT(ISBLANK(JIRACurrency)) && JIRACurrency <> "",
            JIRACurrency,
            BLANK()
        )
    )

无表关系时的实现

如果未建立表关系,使用LOOKUPVALUE指定物料匹配:

Miara-test = 
VAR CurrentMaterial = SELECTEDVALUE('物料表'[Material no])
VAR BudgetCurrency = LOOKUPVALUE('Budget'[Currency], 'Budget'[Material no], CurrentMaterial)
VAR JIRACurrency = LOOKUPVALUE(JIRA[Currency], JIRA[Material no], CurrentMaterial)
RETURN
    COALESCE(
        IF(BudgetCurrency <> "", BudgetCurrency, BLANK()),
        IF(JIRACurrency <> "", JIRACurrency, BLANK())
    )

结果验证

将该度量值与物料表的Material no字段组合展示,即可得到预期结果:

Material noCurrency
1234USD
5678EUR
1290EUR

内容的提问来源于stack exchange,提问作者Jakub Jabłoński

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.17 18:22:37