powerbi - 计算除零之外的平均值,忽略功率 bi 度量的切片器
问题描述
我正在创建以下度量来计算所有学生的平均分数,不包括零分数。
measure= calculate(average(table[score]),filter(table, table[score]<>0))
但是,我想将此度量与使用切片器的选定学生分数进行比较。
new measure= calculate(average(table[score]),all(table[student]),filter(table, table[score]<>0))
但是,新度量与学生的分数相同,并且没有忽略切片器。
解决方案
您应该使用AVERAGEX
andIF
来计算基于某些条件排除某些记录的平均值。
Average Excluding Zero =
AVERAGEX (
Table,
IF ( Table[Score] <> 0, Table[Score] )
)
然后,
All Students Average Excluding Zero =
CALCULATE (
[Average Excluding Zero],
ALL ( Table[Student] )
)
推荐阅读
- java - 打印数组列表中的元素
- java - 弹出窗口中的Android GridLayout不显示数据
- javascript - 如何通过函数id参数在jQuery中选择元素?
- python - 如何使用 pandas.read_excel() 直接从 Dropbox 的 API 读取 Excel 文件?
- javascript - 如何返回分离的元素?
- c# - 模板化控件中的 ContentPresenter 不起作用
- php - PHP 标头仅在 html 表单完全填满时才有效
- php - Laravel Eloquent 查询检查重叠的开始和结束日期时间字段
- dart - 在按下按钮时创建新的小部件
- javascript - childNode 的 DOM 返回值