[英]power bi how to count Safe / On Risk value for multi columns
In Power Query Editor , create a new table using this below code-在Power Query Editor 中,使用以下代码创建一个新表 -
Please replace your_table_name in this below code with your original Table name .请将以下代码中的your_table_name替换为您的原始表名。
let
Source = your_table_name,
#"Removed Other Columns" = Table.SelectColumns(Source,{"Helmet", "Goggels", "Shoes", "Gloves"}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Removed Other Columns", {}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"Value"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
#"Grouped Rows"
**Keeping Location in the result set"- **在结果集中保留位置”-
let Source = your_table_name,
#"Removed Other Columns" = Table.SelectColumns(Source,{"Location", "Helmet", "Goggels", "Shoes", "Gloves"}),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Removed Other Columns", {"Location"}, "Attribute", "Value"),
#"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
#"Grouped Rows" = Table.Group(#"Removed Columns", {"Location", "Value"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
#"Grouped Rows"
Output will be as below-输出将如下-
Output with location -带位置的输出-
Now you can create your Pie Chart using this new table and the final output will be as below-现在您可以使用这个新表创建饼图,最终输出如下-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.