如何从同一PowerPivot中的多个数据透视表和不同数据源连接切片器 [英] How to connect slicers from multiple pivot tables and different data sources from the same PowerPivot
问题描述
大家好,
希望你很好。
我有来自不同数据源的多个数据透视表中的几个切片器,没有我想要连接的关系,
方便所有表都在同一个PowerPivot中。
我为powerpivot中的每个表创建了数据透视表,其中两个支点的切片器选择是相同的。为方便起见,所有的枢轴和
相关的切片器都在同一个标签中。我想使用一个切片器而不是三个或四个,因为它们都有相同的项(值)可供选择。你可以帮忙吗?
干杯,Zeinu
Hi Zeinu,
>>我想使用一个切片器而不是三个或四个切片器,因为它们都有相同的项目(值)可供选择
来自PowerPivot内置功能,这是不可能的。
您的意思是想要使用一个切片器来过滤所有其他数据透视表吗?如果是这样,切片器是否与所有数据透视表中的相同或行相同?如果所有行都相同,我认为您可以尝试
Workbook_SheetPivotTableChangeSync以使用第一个切片器过滤其他数据透视表。
以下是此方案的简单代码。
Private Sub Workbook_SheetPivotTableChangeSync(ByVal Sh As Object,ByVal Target As PivotTable)
Dim pItem As PivotItem
If Target.Name =" PivotTable1"然后'用于使用切片器的关键数据透视表
ActiveSheet.PivotTables(" PivotTable2")。PivotFields(" X")。ClearAllFilters'清除所有过滤器
'设置可见项
使用ActiveSheet.PivotTables(" PivotTable2")。PivotFields(" X")
For Each pItem In .PivotItems
pItem.Visible = Target.PivotFields(" X")。PivotItems( pItem.Name).Visible
Next pItem
End with
End if
End Sub这是一个演示文件,我建议您使用以下文件进行测试,以检查它是否符合您的要求。
https:// 1drv .ms / x / s!AsyeWQ2z51P3hBXvcAI3XMv1qgNP
最好的问候,
爱德华
Hi All,
Hope you are well.
I have several slicers from multiple pivot tables from different data sources with no relationship that I would like to connect, for convenience all the tables are in the same PowerPivot .
I created pivot tables for each table in powerpivot, the slicer selections for the pivots are identical. For convenience all the pivots and related slicers are in the same tab. I want to use one slicer instead of three or four of them since they all have the same items(values) to choose from. Can you help please?
Cheers, Zeinu
Hi Zeinu,
>> I want to use one slicer instead of three or four of them since they all have the same items(values) to choose from
From PowerPivot built-in function, it is impossible.
Do you mean you want to use one slicer to filter all of other pivot tables? If so, Are the slicers the same or rows of all the Pivot Tables the same? If all of the rows are same, I think you could try
Workbook_SheetPivotTableChangeSync to filter other Pivot Tables with the first slicer. Here is a simple code for this scenario. Private Sub Workbook_SheetPivotTableChangeSync(ByVal Sh As Object, ByVal Target As PivotTable) Dim pItem As PivotItem If Target.Name = "PivotTable1" Then ' the key pivot table which is used to use slicer ActiveSheet.PivotTables("PivotTable2").PivotFields("X").ClearAllFilters 'clear all filters 'set the visible items With ActiveSheet.PivotTables("PivotTable2").PivotFields("X") For Each pItem In .PivotItems pItem.Visible = Target.PivotFields("X").PivotItems(pItem.Name).Visible Next pItem End With End If End SubHere is a demo file, I suggest you make a test with below file to check whether it meets your requirement.
https://1drv.ms/x/s!AsyeWQ2z51P3hBXvcAI3XMv1qgNP
Best Regards,
Edward
这篇关于如何从同一PowerPivot中的多个数据透视表和不同数据源连接切片器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!