如何在PowerBI中向已存在的可视化组添加新数据?

huangapple go评论105阅读模式
英文:

How to add new data to the already existing group for a visualization in PowerBI?

问题

我正在在Power BI中的一个组中添加合同ID(包含4位数字,如1234、2345、2323等),而在另一个组中添加了工单。每当向实时数据中添加新的合同ID时,如何将该合同ID自动添加到该可视化的合同ID组中,以便它不会为每个合同ID创建单独的条形图?

这是应该的外观。但是,每当实时Excel表格中的数据更新时,它看起来像这样。

英文:

I am adding contract ID(containing 4 digits numbers like 1234,2345,2323 etc. ) in a Group in Power BI and WO in a different group. Whenever a new contract ID is added to the live data how can I add that contract ID automatically to that Contract ID group for that visualization so that it wont create separate bars for each contract ID?
如何在PowerBI中向已存在的可视化组添加新数据?

This is how it should look like. but whenever the data is updates in the live excel sheet it looks like this .

如何在PowerBI中向已存在的可视化组添加新数据?

答案1

得分: 1

分组将保持手动处理,如果您以这种方式来处理它。
您可以半自动化它:如果只有一种类型的值将被添加,您可以在右下角选择该选项,然后将分组重命名为该类别。这将自动将所有未分组的值放入此类别下。但是,一旦出现不应计入其中的第二类别值,这就会变得危险。

更好的方法来解决这个问题是,不使用分组,而是使用一个计算列。
这需要您对如何对数据进行分类有非常明确的规则。如果您上面提到的规则(4位数字始终是合同ID)是健壮的,那么您可以使用它。但您也可以添加进一步的规则来进行细化等。

要添加一个计算列,选择您的“视图”选项卡,在工具栏中选择“表工具”,然后点击“新列”。然后,您可以在DAX中添加关于如何计算这个新列的代码。MS链接

DAX代码将类似于这样。

calculated_col= 
if(
    len(Table[ColumnName]) = 4, // 评估列内容的长度
    "合同ID",
    "工单"
)
英文:

Grouping will remain a manual process, if you approach it like that.
You can semi automate it: If only ONE type of values will be added, you can select the option at the bottom right and rename the Group to that cateogry. THis will automatically bin ALL unbinned values under this category. This dangerous however, once a second category value arrives that shouldn't be counted there.

如何在PowerBI中向已存在的可视化组添加新数据?

A better way to approach this problem would be to instead of using groups, using a calculated column.
This requires you to have very clear rules on how to categorize your data. If your rule mentioned above (4 digit numbers are ALWAYS contract ids) is robust, then you can use that. But you can also add further rules to refine it, etc.

To add a calulated column, select your view tab, select tabletools in the toolbar and then hit 'new Column'. Then you can add your code for how this new column is supposed to be calucalted in DAX. Link to MS

如何在PowerBI中向已存在的可视化组添加新数据?

The DAX would look something like this.

calculated_col= 
if(
    len(Table[ColumnName]) = 4, // evaluate length of content of the Column
    "ContractID",
    "Workorder"
)

huangapple
  • 本文由 发表于 2023年6月15日 03:07:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76476825.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定