Thursday 17 July 2008

Date Filters in Excel's Pivot Table

When I browse OLAP cubes using Excel 2007 and put date dimensions in the column or row area, some of them have a Date filter, while others only have a normal Label filter.

I was curious about what makes Excel recognise the dimension as a date dimension and thus makes the Date filter available. So I went about googling and found this post in the MSDN forum: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2174795&SiteID=1. Essentially, setting the ValueColumn of the date dimension's key field to a date type column will help Excel recognise the dimension as a date dimension.

I decided to experiment a bit more with a few different but common combinations of Key, Name and Value columns, to see their effects in Excel. Here are the results:

KeyColumnNameColumnValueColumnDate Filter?
DateDate(none)Yes
DateChar(none)No (*)
DateCharDateYes
IntInt(none)No
IntChar(none)No
IntCharDateYes


(*) Note: in this combination, if you also set the attribute's AttributeHierarchyVisible to false, then Excel makes date filter available for the dimension. However, it seem the filtering doesn't actually work correctly. For example, even if you apply a filter of "after 31/12/9999", every member is still coming through unfiltered.