在powerbi报表中计算男性总数女性总数 [英] Calculate Total male Total Female in powerbi report

查看:872
本文介绍了在powerbi报表中计算男性总数女性总数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在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:


  1. 使用新建表格按钮创建第二张表格,并使用以下代码:

  1. 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报表中计算男性总数女性总数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆