Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |