【问题标题】:Sumx and Relatedtable in Power BIPower BI 中的 Sumx 和相关表
【发布时间】:2021-10-17 18:19:34
【问题描述】:

我想使用 Power BI 在矩阵表中显示每个 Store_city 中每个 Store_id 的产品当前成本度量。

这是我的 DAX:

Product current cost (test) = 
CALCULATE(
    SUMX(
        'Product Lookup',
        'Product Lookup'[current_cost]
    ),
    RELATEDTABLE(
        'Store Lookup'
    )
)

输出:

字段窗格:

Product Lookup 表与 Store Lookup 和 Sales by store 表没有关系。因此,我使用的是 RELATEDTABLE 函数。

我预计每个 store_id 中每个 store_city 的当前成本(来自 Product Lookup 表)值不应相同。

我的 DAX 有什么问题吗?

更新:

产品查找:

商店查找:

【问题讨论】:

  • 产品查找和商店查找表中有哪些列?
  • @AshokAnumula 我已经更新了产品查找和商店查找表。

标签: powerbi dax


【解决方案1】:

您可以通过以下措施获得结果

Product current cost (test) = 
    SUMX(
RELATEDTABLE('Store Lookup'), 'Product Lookup'[current_cost]
)

【讨论】:

  • 如果使用SUMX,我们需要指定表。当我添加产品查找表时,DAX 将与我的相同。
  • @Azul 两个表之间应该至少有一个公共列。那么只有 Relatedtable 有效
  • 你是对的。我不能在这里使用相关表。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多