DAX 按类别衡量

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

我有这个 DAX 指标

Average Weeks in Warehouse = 
  CALCULATE( 
    sum('Stock-Dwellings combined'[PalletWeeksTOTAL]) / 
    sum('Stock-Dwellings combined'[FullPalletsQty])
  )

在表 Stock=Dwellings 组合中,我有字段 CustomerCode,我想将其用作切片器。

如何制定措施仅针对特定的 CutomerCode 字段而不是整个数据集?

powerbi dax
1个回答
0
投票

尝试以下操作:

Average Weeks in Warehouse for Specific Customer = 
CALCULATE( 
    DIVIDE(
        SUM('Stock-Dwellings combined'[PalletWeeksTOTAL]), 
        SUM('Stock-Dwellings combined'[FullPalletsQty]),
        BLANK() 
    ),
    FILTER(
        'Stock-Dwellings combined',
        'Stock-Dwellings combined'[CustomerCode] = "yourCustomerCode"
    )
)
© www.soinside.com 2019 - 2024. All rights reserved.