【问题标题】:Power BI average rating per product每个产品的 Power BI 平均评分
【发布时间】:2018-04-04 10:21:39
【问题描述】:

我有一个 Ratings 表,上面有一些产品评分:

productKey   rating
product-1    4
product-1    5
product-2    3

我想计算每个产品的平均评分:

  • 不正确的平均值(默认)(4+5+3)/3 = 12/3 = 4
  • 平均每个产品( (4+5)/2 + 3 ) / 2 = (4.5 + 3) / 2 = 3.75

我设法用中间表做到了这一点

1) 创建每个产品的平均评分表:

RatingsPerProd = SUMMARIZE(Ratings,Ratings[productKey],"averageRating",AVERAGE(Ratings[rating]))

创建下表:

productKey   averageRating
product-1    4.5
product-2    3

2) 然后我简单地做一个AVERAGEaverageRating

但是,我想在原始 Ratings 表上使用 1 个单一度量来执行此操作,但是无论我尝试使用 SUMMARIZE 公式做什么,都会收到以下错误:

表达式引用了多个列...不能转换为 标量值

我如何才能在原始评分表的 1 个单一衡量标准中达到每个产品的平均值?

【问题讨论】:

    标签: average powerbi summarization


    【解决方案1】:

    你可以试试下面的公式:

    AveragePerProduct =
    AVERAGEX (
        VALUES ( Ratings[productKey] ),
        CALCULATE ( AVERAGE ( Ratings[rating] ) )
    )
    

    结果:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-31
      • 1970-01-01
      相关资源
      最近更新 更多