Power BI:如何从其他表添加切片器? [英] Power BI: How to add slicer from a different table?

查看:818
本文介绍了Power BI:如何从其他表添加切片器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在PowerBI中绘制累积折线图,并向其中添加一些切片器。让我先描述一下我的数据。

I'm trying to plot a cumulative line chart in PowerBI and add some slicers to it. Let me first describe my data.

我的数据如下:

My data looks as below:

要绘制累积图表,我使用以下公式创建一个新表:

To plot a cumulative chart, I'm creating a new table using below formula:

Cumulative = CALENDAR(DATE(2017, 9, 24), DATE(2017, 10, 12))

此新表中,我将添加另外2列,如下所示:

In this new table, I'm adding 2 more columns as below:

Issues_Logged = COUNTROWS(FILTER(Sheet1, Sheet1[Creation_Date].[Date] <= Cumulative[Date].[Date])) + 0
Issues_Resolved = COUNTROWS(FILTER(Sheet1, Sheet1[Resolution_Date].[Date] <= Cumulative[Date].[Date] && Sheet1[Resolution] = "Closed")) + 0

现在我完成的表看起来像这样:

Now my completed table looks like this:

使用上述方法,我的累积图表很好,看起来像这样:

Using above approach my cumulative chart plots fine and looks like this:

这种方法面临的问题是,当我尝试为Group添加切片器(以分组方式查看此数据)时,切片器不会生效。我知道原因是2个表格无关。我看不到如何关联这两个表,或者我是否需要完全改变我的方法。

The problem I'm facing with this approach is that when I try to add a slicer for Group (to view this data group-wise), the slicer does not take effect. I know the reason is that 2 tables are not related. I can't see how to relate those 2 tables, or whether I need to change my approach altogether.

您能帮助我解决如何使切片器在其中工作吗?

Can you help me resolve how to get the slicer working in this case?

注意:将来,原始数据可能还会包含 Priority字段,因此我可能还需要添加切片器。因此,该方法必须具有可扩展性才能实现这一目标。原始数据中的行数有望超过10万。

Note: In future, original data may also include a field "Priority" and I may need to add a slicer for that too. So the approach needs to be scale-able to achieve that. Number of rows in original data is expected to cross 100K.

推荐答案

您应将新字段创建为如果希望它们与其他过滤器一起正确使用,则使用度量而不是计算列

You should create the new fields as Measures instead of Calculated Columns if you want them to work correctly with other filters.

这是因为计算列是根据数据刷新所在的行进行计算的,而度量值的计算是运行时,并且会考虑其他上下文,例如应用的过滤器和用户选择。

It is because Calculated Columns are calculated during data refresh according to the row it is in, while Measures are calculated at run-time and will take into account other contexts like filters applied and user selection.

请参阅计算列 与测量相比,当应用过滤器时:

See the results of Calculated Columns vs Measures when a filter is applied:

这篇关于Power BI:如何从其他表添加切片器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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