简体   繁体   English

在 Power BI 中显示没有值的图表

[英]Show graph with no value in Power BI

I have data in a column which can have only two values - Staff or Temporary我在一列中的数据只能有两个值 - 员工或临时

Right now I have only one entry as shown below -现在我只有一个条目,如下所示 -

在此处输入图像描述

I need to show this in a bar chart with their count as values on Y - axis.我需要在条形图中显示它,并将它们的计数作为 Y 轴上的值。

When I plot it, It shows only Staff with its value because there is only Staff entered in the column as shown in graph -当我 plot 它时,它只显示员工及其值,因为只有员工在列中输入,如图所示 - 在此处输入图像描述

But I need to show both the category on X-axis with Staff and Temporary mentioned and their Count on Y-axis as 70 and 0.但是我需要在 X 轴上显示提到的 Staff 和 Temporary 的类别以及它们在 Y 轴上的计数为 70 和 0。

Is there anyway to do it?有什么办法吗?

Thanks.谢谢。

What would be best in this situation is to create a lookup table that you can use in a relationship.在这种情况下,最好的办法是创建一个可以在关系中使用的查找表。 In this example you have the following two tables:在此示例中,您有以下两个表:

Some Employee Data一些员工数据

在此处输入图像描述

Employee Type员工类型

在此处输入图像描述

And a relationship created between the two tables 'Employee' to 'Employee Type'以及在两个表“员工”到“员工类型”之间创建的关系

在此处输入图像描述

You use the lookup table as the axis, you can then select on the Axis settings 'Show items with no data'您使用查找表作为轴,然后您可以 select 在轴设置“显示没有数据的项目”

在此处输入图像描述

In the above images, both have the Axis 'Employee Type' coming from the linked table.在上面的图像中,两者都有来自链接表的轴“员工类型”。 The one on the left does not have the 'Show items with no data' option selected, the one on the right does.左边的没有选择“显示没有数据的项目”选项,右边的有。

If you want you can add a numerical column to the 'Employee Type' table to use 'Sort by other column' to order them in a defined order, rather than alphabetical.如果您愿意,您可以在“员工类型”表中添加一个数字列,以使用“按其他列排序”以定义的顺序而不是字母顺序对它们进行排序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM