Change date in a OLAP Cube based pivot table

Hans10

New Member
Joined
Jul 22, 2015
Messages
8
I have had posted a similar issue earlier, but it did not solve my problem. Therefore, I try again.

My Pivot table gets data from a OLAP Cube. Using the macrorecorder i got this code by setting a new date in the filter and then update the Pivot table. I can manually change the date and it will update when running the macro again.

Sub Update_pvt1()

With Sheets("pvt 1").PivotTables("Pivottabel1")
.PivotFields("[Dato].[AarMaanedDagH].[Aar]").ClearAllFilters
.CubeFields(47).EnableMultiplePageItems = True
.PivotFields("[Dato].[AarMaanedDagH].[Aar]").VisibleItemsList = Array("")
.PivotFields("[Dato].[AarMaanedDagH].[AarMd]").VisibleItemsList = Array("")
.PivotFields("[Dato].[AarMaanedDagH].[AarMaanedDag]").VisibleItemsList = Array("[Dato].[AarMaanedDagH].[AarMaanedDag].&[20150826]")
.PivotTables("Pivottabel1").PivotCache.Refresh

End With
End Sub

In my case i will always have to update my Pivot table to the day before (yesterday!)


Solution 1: Maybe you can put this in the code in one way or another?

Array("[Dato].[AarMaanedDagH].[AarMaanedDag].&[Format(Date - 1, "YYYYMMDD")]")


Solution 2: The trick where you use a range/cell reference? But the trick has not worked for me in the past!


Be aware that the date in my Cube is formated like this "YYYYMMDD" example "20150827" for today.

Any
suggestions? it has been an ongoing problem and i have many tables that i almost every day wants to update.

Thanks to jorismoerings for showing interest in my previous posted thread.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top