admin 管理员组文章数量: 1086019
I have a table UPS with 2 columns
location | Maint_1 | Maint_2 |
---|---|---|
City1 | Yes | n/a |
City2 | Yes | Yes |
City3 | No | |
City4 | Yes | No |
I have a table UPS with 2 columns
location | Maint_1 | Maint_2 |
---|---|---|
City1 | Yes | n/a |
City2 | Yes | Yes |
City3 | No | |
City4 | Yes | No |
I need to calculate percentage (Measure in Power BI) of Cities where no maintenance is done from the 2 Maint_1 & Maint_2 columns, ignoring the "n/a" and null/no values.
In the above table, "%Cities with no maint" = 2/6 = 33.33
numerator = 2 (No + No)
divisor = 6 (Yes + Yes + No + Yes + Yes + No)
Share Improve this question edited Mar 29 at 20:05 Barbaros Özhan 65.5k11 gold badges36 silver badges61 bronze badges asked Mar 29 at 19:58 cghantacghanta 373 bronze badges 1- if all values are Yes, the answer should be 0.00 – cghanta Commented Mar 29 at 20:06
1 Answer
Reset to default 2you can select the first column in PQ and unpivot other columns
then create a measure
MEASURE =
COUNTX ( FILTER ( 'Table', 'Table'[Value] = "No" ), 'Table'[Value] )
/ COUNTX (
FILTER ( 'Table', 'Table'[Value] <> "" && 'Table'[Value] <> "n/a" ),
'Table'[Value]
)
本文标签: powerbiCalculate percentage from 2 columnsStack Overflow
版权声明:本文标题:powerbi - Calculate percentage from 2 columns - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744005086a2517140.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论