Power BI-自定义列获取级别
我已经创建了这样的成本帐户
,这就是数据导入数据时的外观。
我不确定如何在Power BI中开发自定义列,该列可以返回水平并同时保持关系。
例如,
- 对于网站作品,我在自定义列中获得一个值“级别0”,
- 用于子结构我在自定义列中获得一个值“ 1级” [child to site works parent]
- 在未分类的土壤中发掘我在未分类的土壤中获得了一个值“自定义列[孩子到子结构父母]
列指示孩子属于父母。如果是762,那么它是762“ 1级”的“ 1级”,
请有人可以帮助使用此用例吗?
非常感谢。
I have created the cost account like this
And this is how it looks in Power BI when data imported.
I am not sure how to develop a custom column in Power BI that can return levels and at the same time maintain relationship.
For instance
- For SITE WORKS I get a value “Level 0” in custom column
- For Substructure I get a value “Level 1” in custom column [Child to SITE WORKS Parent]
- For Excavation in unclassified soil I get a value “Level 2” in custom column [Child to Substructure Parent]
The column is indicating the child belongs to which parent. If is 762, then it is a “Level 1” of to 762 “Level 1”
Can someone please help with this use case?
Much Appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于您正在Power BI工作,因此您可能需要尝试使用DAX的方法。
此方法可能有两个原因更好:
因此,请尝试使用:
将原始表加载到Power BI中。然后切换到数据视图以查看它。
然后单击列工具> 新列并将其输入到公式框中:
然后再次单击 再次输入该公式框中:
然后点击Enter键,或者基本上单击公式外的任何地方盒子。
那应该做到。您应该看到这样的东西:
您可能会发现这个有用的。我做到了。
Since you are working in Power BI, you might want to try this approach that uses DAX.
This method could probably be better for two reasons:
So, try this instead:
Load your original table into Power BI. Then switch to the Data view to look at it.
Then click Column Tools > New Column and enter this into the formula box:
Then click New Column again and enter this into the formula box:
Then either hit the Enter key or click basically anywhere outside the formula box.
That should do it. You should see something like this:
You might find this helpful. I did.
根据您最近添加了NBA的评论,这将更新。
它需要与我的原始答案不同,也许更好的方法。
我从电源查询中的表格开始:
我称其为“表”,并引用了以下内容:
它给了我这样的结果:
当您在帖子中共享电源查询时,仍然可以使用表格查询,您只需要更改我对Table1的引用即可使用我的代码。
This is updated per your recent comment that you added NBA.
It takes a different, perhaps better(?) approach than my original answer.
I started with a table like yours in Power Query:
I called it "Table" and referenced it for the following:
It gives me a result like this:
Assuming you still have your table in Power Query as you shared it in you post, you should only need to change my reference to Table1 in order to use my code.
感谢您帮助我离开Marc Pincince。我使用了您提供的相同代码,并且结果略有不同
snap
Thanks for helping me out Marc Pincince. I used the same code you provided and I'm getting a slightly different result as below
snap