问题描述
我想在powerbi报告中统计男性和女性的总数
I want to count the total number of males and females in a powerbi report
例如。
Name Gender
std1 Female
std2 Male
std3 Female
std4 Male
std5 Male
std6 Male
我想要的结果是:
Female 2
Male 4
推荐答案
要获得所需的结果,请按照以下步骤操作:
To get the results you are looking for, follow these steps:
-
使用新建表格按钮创建第二张表格,并使用以下代码:
Make a second table using the New Table button with the following code:
GenderCounts = DISTINCT(TableName[Gender])
使关系从新创建的表回到原始表
Make a relationship from the newly create table back to the original table
使用以下代码将新列添加到GenderCounts表中:
Add a new column to the GenderCounts table with the following code:
Count = COUNTROWS(RELATEDTABLE(TableName))
还有第二个表c实现每种性别的计数。
And there you have a second table containing the counts of each gender.
有关详细信息和其他可能性,请查看相关的Power BI社区论坛帖子和Stackoverflow问题和。
For more information and other possibilities, check out a related Power BI Community forum post here and Stackoverflow questions here and here.
这篇关于在powerbi报表中计算男性总数女性总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!