powerbi - 如何使用 DAX 在 Power BI 中计算加权平均值?
问题描述
我的数据表如下所示:
Country | Total | Days
A | 56 | 3
B | 23 | 5
C | 22 | 2
D | 90 | BLANK
我想找到由 4 个步骤组成的加权平均值
Step 1 : Multiply Total into Days where Days is not blank (i.e to consider only non blank values). lets name the new column formed "Product:
Step 2 : Take the Subtotal sum of the PRODUCT
Step 3 : Take the Subtotal sum of TOTAL
Step 4 : Step 2 / Step 3
即使在 EXCEL 上完成,我也无法在 Power BI 中执行此操作。有人可以帮我吗?
解决方案
您可以创建以下度量 -
Measure 2 = DIVIDE(sumx('Table','Table'[Days]*'Table'[Total]), SUM('Table'[Total]))
推荐阅读
- java - 安装后菜单在 Eclispe SDK 中不可见
- css - elementor网站上mac中的字体系列覆盖
- java - 如何根据GZIP的压缩字节数组得到原始数组的长度?
- postgresql - PostgreSQL 10 逻辑复制 - 是否可以克隆表?
- c - sizeof('0') 的值是多少?
- javascript - 通过 SVG 保存和加载图钉标记
- kotlin - 减少嵌套循环的可能性
- azure-data-studio - 如何在 Azure Data Studio 连接中仅打开选定的数据库
- c++ - 如果构造函数被显式默认或删除,为什么自 C++20 以来聚合初始化不再起作用?
- java - 如何正确处理服务器端和客户端的节省时间