I have a data cube pivot table Period split by [Fin Year - WK - Date] (financial year - week number - date).
I filter the table by a date period: using VBA I am selecting a 7 day period by date, based on a cell holding a date.
I am not selecting the week number as this is never referred to or calculated by the end users.
The 7 days are correctly selected in the filter, but the 'parent' week number remains partially selected.
This results in a measure not populating as the week dimension is not selected.
Is there a method in VBA to select the parent of a filter? ie given 30/11/23, select the parent which happens to be Week 19.
I filter the table by a date period: using VBA I am selecting a 7 day period by date, based on a cell holding a date.
I am not selecting the week number as this is never referred to or calculated by the end users.
VBA Code:
Sheets("z").PivotTables("y").CubeFields(89).EnableMultiplePageItems _
= True
Sheets("z").PivotTables("y").PivotFields( _
"[Period].[Fin Year - WK - Date].[Date]").VisibleItemsList = Array( _
"[Period].[Fin Year - WK - Date].[Date].&[" & Format(Cells(2, 3).Value, "yyyy-mm-dd") & "T00:00:00]", _
"[Period].[Fin Year - WK - Date].[Date].&[" & Format(Cells(2, 3).Value + 1, "yyyy-mm-dd") & "T00:00:00]", _
"[Period].[Fin Year - WK - Date].[Date].&[" & Format(Cells(2, 3).Value + 2, "yyyy-mm-dd") & "T00:00:00]", _
"[Period].[Fin Year - WK - Date].[Date].&[" & Format(Cells(2, 3).Value + 3, "yyyy-mm-dd") & "T00:00:00]", _
"[Period].[Fin Year - WK - Date].[Date].&[" & Format(Cells(2, 3).Value + 4, "yyyy-mm-dd") & "T00:00:00]", _
"[Period].[Fin Year - WK - Date].[Date].&[" & Format(Cells(2, 3).Value + 5, "yyyy-mm-dd") & "T00:00:00]", _
"[Period].[Fin Year - WK - Date].[Date].&[" & Format(Cells(2, 3).Value + 6, "yyyy-mm-dd") & "T00:00:00]")
The 7 days are correctly selected in the filter, but the 'parent' week number remains partially selected.
This results in a measure not populating as the week dimension is not selected.
Is there a method in VBA to select the parent of a filter? ie given 30/11/23, select the parent which happens to be Week 19.