问题描述
说,我正在为名为荷兰航空的客户创建一个饼图,为此,我想在饼图中显示与其他客户(包括匈牙利航空,爱尔兰爱尔兰和冰岛航空公司。根据客户的隐私权规定,我只能显示部分名称,例如他们名字的前三个或四个字母。因此,荷兰航空公司更改为航空公司xxxxxxx
Say I am creating a pie chart for customer called 'Air Holland', for this customer I would like to show the overlap with other customers in a pie chart, including customers called 'Air Hungary', 'Air Ireland' and 'Air Iceland'. Due to privacy regulations of my customers I can only show partial names, e.g. the first three or four letters of their name. 'Air Holland' thus changes to 'Air xxxxxxx'
要在饼图中立即实现此功能,我创建了一个新的CustomerNameMasked列,该列将使用客户名称并替换除前四个字符外,所有字符均带有 x。理想情况下,我想在饼图中使用CustomerName作为图例,然后将CustomerNameMasked作为标签,以便使用CustomerName创建饼图,但是将显示被屏蔽的名称。
To implement this now in my pie chart, I have created a new Column CustomerNameMasked that takes the customer name, and replaces all characters but the first four with an 'x'. Ideally I would like to use CustomerName as the Legend in my pie chart, and then the CustomerNameMasked as the label, such that the pie chart is created using CustomerName, but will show the masked names.
但是,据我所知,这样的标签是不可能的,所以现在我将CustomerNameMasked用作我的图例列。但是,由于这些名称不是唯一的(例如,CustomerNameMasked列中的匈牙利航空和荷兰航空都是 Air xxxxxxx),因此将不同的顾客放在一起。
However, as far as I know such a label is not possible, so now I have used CustomerNameMasked as my Legend column. But since these name are not unique (e.g. 'Air Hungary' and 'Air Holland' are both 'Air xxxxxxx' in the CustomerNameMasked column), different customers are taken together.
有什么想法如何创建独特的蒙版客户名称?还是另一种解决方法,以确保我的饼形图正确显示每个客户的数据,但图例显示带掩码的名称?
Any ideas how to create unique masked customer names? Or another work-around to ensure that my pie chart correctly shows the data per customer, but the legend shows masked names?
推荐答案
防止匿名名称在可视化中合并的一种方法是确保它们不相同。
One way of preventing anonymised names from being merged in visualisations is to make sure they are not the same.
列:
Anonymised = "Airline " & RANKX('MyTable','MyTable'[CustomerName],,ASC,Dense)
结果:
Airline 1
Airline 2
Airline 3
...
如果您喜欢 x
's:
添加 Anonymised_Name
表,
Name Anonymised Name
"Air Holland" "Air xxxxxxx"
"Air Hungary" "Air xxxxxxx "
"Air Iceland" "Air xxxxxxx "
使用假空间(数字键盘上的alt + 0160)来防止PowerBI吞噬它。添加关系并在可视化中使用此列。
Use "fake space" (alt+0160 on the numpad) to prevent PowerBI from swallowing it up. Add a relationship and use this column in visualisations.
我更喜欢以前的选项,因为它可以更容易区分和跟踪单个客户。
I prefer previous option as it makes it easier to distinguish and keep track of individual customers.
如果您不在乎 x的数量是否与真实姓名匹配:
If you don't care whether number of "x"s matches real name:
Anonymised_Name_2 = "Air XXXXXXX" & REPT(" ",
RANKX('MyTable','MyTable'[CustomerName],,ASC,Dense))
(再次使用假空间alt + 0160)
(again fake space alt+0160)
根据您对报告的处理方式,真实客户名泄漏的风险很大,因此理想情况下,您需要在导入数据之前匿名化数据。
Depending on what you do with your report, there is a significant risk of real customer names "leaking", so ideally you would want to anonymize your data before importing it.
这篇关于如何在PowerBI中匿名/屏蔽字符串的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!