PowerBI - 用空格替换零 [英] PowerBI - Replace Zeros with Blanks

查看:275
本文介绍了PowerBI - 用空格替换零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一份 PowerBI 报告,其中显示了代表我们按客户销售的支持小时数的数字列.这些数字是由男性在 PowerBI 中计算出来的.

I have a PowerBI Report showing columns of figures representing hours of support we've sold by customer. Those figures are calculated in PowerBI by men.

但有些客户没有购买任何支持 - 所以我想将这些客户的列显示为空白,而不是零.

But some customers haven't bought any support - so I want to show those columns for those customers as blank, not zero.

我可以通过将整个列转换为文本而不是数字来轻松完成此操作,并且空白字段可以只是".但用户希望能够导出视觉效果,并在导出到 Excel 时让数字成为数字(而不是文本).

I can do this easily by turning the whole column to text, rather than numeric, and the blank fields can just be "". But users want to be able to export the visual and have the numbers be numbers (not text) when it gets to Excel.

在这种情况下,有什么办法可以让 0 值显示为空白?

Is there any way I can have 0 values show as blank in this case?

推荐答案

我不确定您是如何设置数据的,以及您真正想用它做什么.但在我们得到一些澄清之前,这是我的看法:

I'm not sure how you've set up your data and what you'd really like to do with it. But until we get some clarifications here's is my take on it:

一些示例数据:

Hours,Customer
1,AA
2,BB
2,CC
0,DD
4,EE

如果您使用 Get Data 导入该数据并激活 Power Query Editor,则可以右键单击 Hours,选择 替换值 并用 null 替换 0 得到这个:

If you import that data using Get Data and activate the Power Query Editor, you can right-click Hours, select Replace Values and replace 0 with null to get this:

点击Close&Apply返回桌面并选择Clustered Column Chart.将 Customer 分配给 Axis 并将 Hours 分配给 Values 以便您得到:

Click Close&Apply to get back to the desktop and select a Clustered Column Chart. Assign Customer to Axis and Hours to Values so that you get this:

如您所见,DD 不存在,我相信这是您希望说明数据的方式.但是现在你也可以点击VISUALIZATIONS >下的Customer;轴 并选择显示没有数据的项目:

As you can see, DD is not there, which I believe is how you'd like to illustrate your data. But now you can also click Customer under VISUALIZATIONS > Axis and select Show items with no data:

你会得到这个:

如果您现在选择 Export Data 你会得到一个包含所有客户的 txt 文件,但没有客户 DD 的数据 最初具有 0 的值:

If you now select Export Data you'll get a txt file with all the customers, but with no data for customer DD that originally had the value 0:

如果这不是您要找的,请告诉我.

Please let me know if this is not what you were looking for.

这篇关于PowerBI - 用空格替换零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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