Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
I have a parameter file below to set filters and a subroutine to read the parameters and set the filters in a pivottable. The filters for the first 2 columns (lines 2 [Environment] and 3 [ENT_PERIOD_END_DT]) work as expected, values get set. The third column (row 4) does not. The most puzzling part is the code runs the statement pf.ClearAllFilters then aborts with a 1004 the item could not be found in the Olap Cube on the line with the statement pf.CurrentPageName = FilterVal. I recorded a manual change to this filter and that code fails with the same error. Manually setting the filter on the sheet works fine. Is it possible there is something in the Powerpivot model that is preventing this filter from being changed in VBA. Any suggestions?
Parameters
Worksheet,Filter,Value,Type Occupancy (Monthly),[Environment].[Environment].[Environment],[Environment].[Environment].&[QAGDW],string Occupancy (Monthly),[Dim_Calendar_D].[ENT_PERIOD_END_DT].[ENT_PERIOD_END_DT],[Dim_Calendar_D].[ENT_PERIOD_END_DT].&[2016-03-31T00:00:00],date Occupancy (Monthly),[Supp_Portfolio_D].[SUPPLEMENTAL_PORTFOLIO_NAME].[SUPPLEMENTAL_PORTFOLIO_NAME],[Supp_Portfolio_D].[SUPPLEMENTAL_PORTFOLIO_NAME].&[Operations],string
And This sub-routine
Sub SetPivotFilters()
Dim FilterCol As String
Dim FilterVal As String
myWorksheetpath = ThisWorkbook.Path
myParmFileName = Split(ThisWorkbook.Name, ".")(0) & "_parms.csv"
Open ThisWorkbook.Path & "\" & myParmFileName For Input As #1
row_number = 0
'Application.EnableEvents = False
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
Do Until EOF(1)
Line Input #1, LineFromFile
LineItems = Split(LineFromFile, ",")
FilterCol = LineItems(1)
FilterVal = LineItems(2)
'skip heading line in parm file
If row_number > 0 Then
Dim pf As PivotField
For Each pvt In ActiveSheet.PivotTables
myname = pvt.Name
'pvt.ManualUpdate = True
Set pf = pvt.PivotFields(FilterCol)
pf.ClearAllFilters
pf.CurrentPageName = FilterVal
Next
End If
We have the same issue... Was there ever a resolution for this ?
I was able to make it work by replacing the CurrentPage to CurrentPageName in the recorded macro.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 8 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |