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

Power BI技术求助:如何筛选保留拥有2款及以上产品的客户

解决Power BI筛选拥有2款及以上DS产品客户的问题

原公式的问题分析

你的公式未生效主要有两个核心问题:

  • 用COUNT统计产品数会重复计算同一客户的同款产品,应该用DISTINCTCOUNT来统计不同产品的数量
  • 公式里未限定只统计DS产品,导致统计范围是所有产品,不符合你的需求

解决方案

根据使用场景,分两种情况给出正确的DAX代码:

1. 作为度量值(推荐,适配报表动态筛选)

DistinctDSProductCount = 
VAR CustomerProductCounts = 
    SUMMARIZE(
        'General Journal Account Entry',
        Projects[Customer Name],
        "DS_Product_Count", 
        DISTINCTCOUNT(
            FILTER('General Journal Account Entry', 'General Journal Account Entry'[Product Category] = "DS")
        )
    )
RETURN
    COUNTROWS(FILTER(CustomerProductCounts, [DS_Product_Count] >= 2))

更简洁的写法:

DistinctDSProductCount = 
CALCULATE(
    DISTINCTCOUNT(Projects[Customer Name]),
    FILTER(
        VALUES(Projects[Customer Name]),
        CALCULATE(
            DISTINCTCOUNT('General Journal Account Entry'[Product Name]),
            'General Journal Account Entry'[Product Category] = "DS"
        ) >= 2
    )
)

2. 作为计算列(给客户表新增标记列)

如果需要直接在客户表中标记符合条件的客户,可使用这个计算列:

Has2PlusDSProducts = 
VAR DSProductCount = 
    CALCULATE(
        DISTINCTCOUNT('General Journal Account Entry'[Product Name]),
        'General Journal Account Entry'[Product Category] = "DS",
        ALLEXCEPT(Projects, Projects[Customer Name])
    )
RETURN
    IF(DSProductCount >= 2, "是", "否")

之后在报表筛选器中选择Has2PlusDSProducts = "是"即可过滤出目标客户。

额外注意事项

  • 确保'General Journal Account Entry'表中有标记DS产品的字段(示例中用Product Category,请替换为你实际使用的字段名)
  • 确认Projects表与General Journal Account Entry表已建立正确的数据关联

内容的提问来源于stack exchange,提问作者Abhay Prasad

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 18:22:35