LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default PivotTable filter ordering

Hi There

I have a pivot table based on a cube. At the moment the database behind the
cube has dates until the end of this year in descending order. When the data
is loaded into a pivottable and the dates are selected as a report filter,
they are not in descending order. I would also like a way to stop the dates
in the future from being displayed in the report filter.

1. Timothy Zapawas book €śExcel 2007 Advanced Report Development€ť pp276 said
I could drag that field into the row labels or column labels area, sort it
there, then drag it back to the report filter. This hasnt worked.

2. Another option was to apply filters by manually adding the cube field to
the pivottable (see http://msdn2.microsoft.com.en-us/library/bb256319.aspx
and http://ssas-info.com/RamunasBalukonisBlog/?p=25)

First of all, Ive needed to get a list of all of the programmatic field
names for the pivottable. This didnt work because the cube based fields
arent referred to as PivotFields €¦(Application Error 1004)

Sub List_PvtFields()
Dim pvtTable As PivotTable
Dim pvtField As PivotField
Dim objNewSheet As Object
Dim intRow As Integer

Set objNewSheet = Worksheets.Add
objNewSheet.Activate
intRow = 1

Set pvtTable = ActiveSheet.PivotTables(1)
For Each pvtField In pvtTable.PivotFields
objNewSheet.Cells(intRow, 1).Value = pvtField.Name
intRow = intRow + 1
Next pvtField

End Sub

The following did work€¦

Sub list_cube_fields()
Dim objNewSheet As Object
Dim intRow As Integer
Dim objCubeFld As Object

Set objNewSheet = Worksheets.Add
objNewSheet.Activate
intRow = 1
For Each objCubeFld In Worksheets("DailyGraph").PivotTables(1).CubeFields
objNewSheet.Cells(intRow, 1).Value = objCubeFld.Name
intRow = intRow + 1
Next objCubeFld
End Sub

Next I followed (see http://msdn2.microsoft.com.en-us/library/bb256319.aspx)
andI think that the following line worked€¦.


ActiveSheet.PivotTables("ptDailyGraph").CubeFields ("[Date].[Year]").CreatePivotFields

So this should have added this cube field as a pivottable field. But this
next line doent work€¦(I get €śRunTime Error 438 €“ Object does not support
this property or method€ť)


ActiveSheet.PivotTables("ptDailyGraph").PivotField ("[Date].[Year]").VisibleItemsList = Array("[Date].[Year].&[2006]", "[Date].[Year].&[2007]")

Ive also tried this line€¦and got the same error message€¦


ActiveSheet.PivotTables("ptDailyGraph").PivotField ("[Date].[Year]").AutoSort
xlDescending

Any ideas?
--
Thank You in Advance,

Michael Anderson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter PivotTable dropdown items to match report filter Catherine D Excel Discussion (Misc queries) 1 August 16th 08 12:12 AM
Report Filter in PivotTable Hutch Excel Discussion (Misc queries) 1 May 30th 08 08:35 PM
Pivottable filter Looping through Excel Programming 6 December 7th 07 09:46 PM
Pivottable Filter excelrook Excel Discussion (Misc queries) 2 February 21st 07 08:34 PM
re-ordering the list on a filter drop down Kylor Excel Discussion (Misc queries) 3 December 19th 05 06:59 PM


All times are GMT +1. The time now is 12:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"