Filter OLAP Pivot Table Based On Named Range In Another Worksheet

Mar 14, 2012

I have a named range of values on Sheet2 (GPI). Sheet1 is an OLAP pivot table containing row label (GPI 14) and values (Net Rx Count) only.

Unfiltered this list is over 7,000 rows. I need VBA code to display only those rows where the GPI 14 value matches any value in the named GPI range on Sheet2.

In other words how can I display the select rows without manually selecting the items of interest AND without manually hard coding the values in the code as they will change.

Below is 1 of the many codes I tried. This appears to be the most intuitive but I get an 'invalid procedure" error at Set my PivotTable...

'Sub PivotAnalysis()
'
Dim myPivotTable As Excel.PivotTable
Dim myPivotField As Excel.PivotField
Dim myPivotItem As Excel.PivotItem

[Code]....

View 4 Replies


ADVERTISEMENT

Excel 2010 :: Changing Pivot Table Report Filter Via VBA With Named Range Or Array

Jul 21, 2011

I have a set of four pivot tables on a sheet that I need to programmatically change a Report Filter (Page Field) so I can create sets of reports in an automated fashion. This will be the first step in that process. The change will involve choosing > 1 Role each time the code loops through based on Named Ranges I've defined that are associated with that Role.

My code thus far:

Code:
Sub TestCode()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem

[Code]....

emm_dc_gsr is one of many Named Ranges that will contain a variable number of elements. Just using the one right now to see if I can get the code to work, I'll eventually make another Named Range/Array of all them so I can loop through each Report ("ReportPick").

I want the Report Filter to consult that Named Range for its values and apply those values to PivotField "Role" that is used as a Report Filter.

When running this code above, I get a "Role" Field that says "All" but no values (the table is completely blank), with no evidence as to why it'd be blank (all filters in every Report, Column and Row are working normally and are filled in). When I choose a value manually after the code is run, the pivot table values populate. Do I need to somehow index the Named Range in that loop? I'm just confused about this step right here:

For Each pi In pf.PivotItems
If pi.Value = RolePick Then
pi.Visible = True
Else: pi.Value = False

When I've run other versions of the code, I've gotten an array version of it to "work" using LBound and UBound, but it never chooses the right two values even though those are verified as stored in the array via a pass-through. It chooses the first few values in the Report Filter.

Here's the corresponding code for that:

For i = LBound(myArray) To UBound(myArray)
pf.PivotItems(i).Name = myArray(i, 1).Value
pf.PivotItems(i).Visible = True
Next

I do not care if I use an array or a Named Range. I just want something that is simple and works. Passing the values directly from the named range seems easiest to my brain, but I'm open to anything and I'm clearly missing something (probably silly).

I also have no idea why " .AutoSort xlManual, .SourceName, .EnableMultiplePageItems" is necessary though every piece of sample code I've seen seems to have some variation of it.

(Using Excel 2010, Windows 7.)

View 9 Replies View Related

OLAP Pivot Table Hierarchic Dimensions

Jul 19, 2006

I am working now on macros changing the datas in a pivot table created from a OLAP cube. I have there some hierarchic dimensions in the format of Category.Group.Item etc. When creating a macro with recorder i get something like this...

ActiveSheet.PivotTables("cube").PivotFields("[Dim_Item]").CurrentPageName = _
"[Dim_Item].[All Dim_Item].[CategoryA].[GroupA4].[Item550321]"

Is somewhere out there any tutorial to that [All Dim_Item] thing? ... cause i feel there IS what i need, that with some cunning command i could show an item without knowing his group and category, but i cant get the macro working.

View 6 Replies View Related

Sorting Data From Olap Pivot Table

Mar 18, 2007

i have generated a olap cube and display it using pivot table. But i am unable to sort my data from acsending order. For example: I had right clicked on my pivot table > field settings > Advanced > Select "Ascending". The data (sum of quantity) remains unsort after i have checked ok.

View 2 Replies View Related

OLAP Cube Pivot Table - Get Current Page Items Selected

Oct 26, 2006

Is it possible to get the current Page Item Selected for a pivot table

I've tried the following functions in VBA, but have had no success

CurrentPageName
CurrentPage
CurrentPageItem
ParentItems

View 9 Replies View Related

Excel 2007 :: Add Calculated Members In Pivot Table From SSAS OLAP Cube

Nov 4, 2012

I use Excel to query a SSAS OLAP Cube, the return of which I then model into various outputs. I do not have access to amend the cube.

I am hoping it is possible to be able to add custom calculated members to some dimensions in excel rather than on the server, but I'm struggling to find any resources that explains how it is done or if it is even possible. For example, the cube will return the dimension 'Source Country' with members 'England', 'Northern Ireland', 'Scotland', 'Wales', I would like to add a calculated member 'United Kingdom' to consolidate all those members.

Is this possible or should I just look to calculate this consolidation by formulas in the model.

Excel 2007
Win7 Pro

View 1 Replies View Related

Filter Pivot Table Based On Cell Value

Jan 9, 2014

From what I understand there's no way to do this without using macros. I would perfer not to use macros, but I need my PivotTables to auto-refresh anyways and apparently that will require a macro, so oh well. I'm very new to macro coding so I can't seem to successful apply any of the previous threads about this to my sheet.

I just need my pivot table on sheet "Customer" to filter the customer field based on the value in cell C1. Also I need to make sure the sheet doesn't "freak out" if the value in C1 is either blank, or is a customer value which doesn't exist in the table. Preferably in this scenario it would display nothing on the pivot table, but I don't know if that's possible. I want the sheet/macro to allow an invalid filter value in C1 just so the sheet doesn't lock up until it is corrected.

I also need my workbook to auto-refresh all the pivot tables is that's easy to code in as well.

View 2 Replies View Related

Filter Pivot Table Based On Cell?

Mar 11, 2014

I try filter a pivot table based a cell.

[Code] .....

Attached File : FilterPT.xlsx

View 3 Replies View Related

Report Filter In Pivot Table Based On Another Field From The List?

Feb 20, 2012

Is it possible to set up the second level of a report filter based on the value of the first report filter. I have a pivot table that needs two report filters: first is the location and the second is the department. What I want to do is have the user be able to select the location and then only show valid departments for that location. I know that this is possible if I set up a form and have the second field be a query against the first. I can create a calculated field but I cannot put that in the report filter area.

View 2 Replies View Related

Filter Pivot Table Based On Data Validation In Another Sheet

Feb 14, 2013

I found this code and am trying to use it to update the filter in my pivot table (sheet 6), based on the data validation selection in sheet 1, but when I make my selection on sheet 1, nothing happens.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet
Dim pt As PivotTable
Dim pi As PivotItem
Dim strField As String
strField = "Region"

[code]....

View 3 Replies View Related

Macro To Pick Up A Range Of Date To Filter On In A Pivot Table

Jun 25, 2008

When using a Pivot Table I regularly filter on known data specific to me i.e. WBS codes.

Column ‘A’ contains the WBS Codes which can be as many a 1000, however, I only need to filter out the 10 or so I require, and currently I uncheck all the records and manually scroll through the list to check the ones I require.

In order to speed things up I recorded a macro which works fine, however, If I need to check any new codes I would have to record the macro again, as I tried to edit the Macro and all it does is to un check all the other codes I don't need.

Is it possible to create a Macro that picks up a range of data that is then used to filter on. (i.e. only the records I require)

View 9 Replies View Related

Excel 2007 :: One Pivot Table - Multiple Graphs Based On Report Filter?

Jan 10, 2014

I have a perfectly working pivot table and I would like to make some graphs based on the report filter. My report filter has 4 categories, with each more than 10 sublevels.

When I make one pivot graph/chart, this goes fine, the data is ok, and I am happy. But one I make a second, and thus adjust the report filter, the first graphs changes according to the filter. I dont want that to happen

Ultimately I would like a powerpoint presentation with multiple charts, based on one table, with different report filter filters. Updated ONLY on the values, not the filter.

View 4 Replies View Related

Excel 2010 :: Pivot Table Add Calculated Field Based On Certain Text In Report Filter

May 29, 2014

Any way to create a calculated field in an Excel 2010 pivot table that will find all the Transaction Types (Report Filter) with "transportation" in them and make the field Quantity 0 and leave all other quantities the same? I do not want the quantity of transportation added in twice and may not have the flexibility of adding a column to the raw data.

I used the formula below in a calculated field and it does not match the values using the added column to the data file.

=IF(ISERROR(SEARCH("*transportation*",'Transaction Type')),Quantity, 0)

I am trying to get the sum of Quantity field to equal the AdjQuantity field using a calculated Pivot field and not add a new column to the data.

View 2 Replies View Related

Copy Named Range Data To Worksheet Based On Dropdown Or Combobox

Feb 10, 2013

I have a worksheet called "Lookup" with several dynamic named ranges (each is 1 column wide) including facility, department, shift, etc. On a summary worksheet in the same workbook I want users to use a dropdown or combo box (don't care what type) in cell B2 to select a facility and then based on their selection, copy the department named range data and paste it into the summary sheet beginning in cell A5 and paste the shift named range data into the summary sheet beginning in cell B5.

Example: user selects "AR Plant" from the dropdown or combo box and the data from the "AR_Rpt" named range is pasted into cell A5 and the "AR_Shift" named range is pasted into cell B5.

View 9 Replies View Related

Sort A Pivot Table Based On A Range

Nov 12, 2009

I wonder if someone can tell me if it is possible to sort rows in a pivot table based on a range in the same workbook.

I have the pivot table set up as I need it but the values in the row change each time the macro is run (it is run when new data is added)

As part of the macro a list of Grades is imported into the Workbook. These grades are always imported in the correct order. As such I would like the pivot table to follow the order of imported grade list. The grades in the list will always be the same as the list in the pivot table.

Is this something that would be possible to do?

View 8 Replies View Related

Apply A Filter In A Pivot Table And Extract Results In A Table

Jul 24, 2008

I have made a pivot table and I dlike to identify with a macro the documents with net value over 1000. Then extract these values next to the respective sales documents in an are near the pivot table somewhere. The fields are called Document and Sum of Net value. Of course the pivot is very variable one time it has 3000 records and another 5000.

View 9 Replies View Related

VBA - Change Data Source Of Pivot Table With Range Changing Based On Cell Value?

Mar 5, 2013

I have the following code to update a pivot table:

Code:
Dim pt As PivotTable
Application.EnableCancelKey = xlDisabled
For Each pt In ActiveWorkbook.Worksheets("sheet1").PivotTables
pt.ChangePivotCache ActiveWorkbook.PivotCaches.Create _
(SourceType:=xlDatabase, SourceData:="source!R4C1:R33443C55" _
, Version:=xlPivotTableVersion10)

Next pt

the R33443 term is what will be changing, the columns and the starting row should stay the same. is there a way to instead of using R33443, to enable the range to be changed based on a cell value?

View 2 Replies View Related

How To Filter With Named Range In Vba

Feb 16, 2009

I have listed occupations and name ranged them as "Min". with the vba code on how to filter Column E with the Named Range "Min"

View 9 Replies View Related

Applying Named Ranges To Pivot Table

Oct 6, 2008

I have a range of data that is added to constently. I named the range "Download" and defined it as =Indirect(Sheet1!B3) where Sheet1!B3 has another formula which produces the range of the data. I want to apply the named range to a pivot table so that when it updates, the range is updated as well but i'm not sure on how to do this. I put the word "download" in the range input of the pivot table wizard but it results in an error and doesn't complete. how can i set the pivot table's range to the named range that I defined?

View 5 Replies View Related

VBA Pivot Table Filter

Apr 6, 2013

I am trying to filter onto Date field in my pivot table with a start date and an end date with VBA (please find code below).

However, my code single makes all pivot items invisible.

Bascially, in cell B1, I have my start date i.e. 05/04/2013 and end date in cell C1. I would like to filter out only items within these dates.

VB:
Sub PTFilterTest()

Dim ptPvt As PivotTable
Dim ptFld As PivotField
Dim i As Long
Dim dtBegin As Date
Dim dtEnd As Date

[Code] .....

View 2 Replies View Related

VBA - Pivot Table Filter Set?

Oct 23, 2012

I'm trying to have a command button clear all filters on a pivot table (PivotTable1) and apply a new filter equal to a cell value (C4). If the cell value can't be found I want the filter to equal "No Meeting". I'm trying to recycle the code from another workbook I built a long time ago, I just can't get it to convert to this application.

Code:
Dim County As IntegerDim pvtTable As PivotTable
Dim pvtField As PivotField
Dim pvtItem As PivotItem

[Code]....

View 1 Replies View Related

Pivot Table Filter

Nov 6, 2008

I have a list of names and a count column, So it counts how many times the names have appeared from my raw data. Simple.

Using excel 2003 what i would like to do is filter the pivot table so it only shows people with a >1 count.

Now in excel 2007 this is really easy and i can just apply a >1 filter. I can't work out what to do in excel 2003.

View 9 Replies View Related

Using Multiple Filter For Pivot Table

Aug 2, 2012

I have a huge excel file. This file contains Projects, Project Manager, departments and sales for different quarters. Each department has sales and the quarter the sale was done. Now I want to create a pivot table where I can see the sales for each quarter for each project or each project manager. Attached file may elaborate the problem. ShaA1.xlsx

View 9 Replies View Related

Filter First X Items Of Pivot Table?

Oct 26, 2013

I've created a PivotTable using VBA that contains hundreds of PivotItems, which would look bad when a PivotChart is made.

I'd like to set the PivotTable to make visible only the first X items (let's say 10). How would I do this in VBA?The macro recorder gives me the name of the PivotItem, but this varies so I'd like to use an index:

VB:
ActiveSheet.PivotTables("PivotTable4").PivotFields("UWI").PivotItems("Item1").Visible = False
ActiveSheet.PivotTables("PivotTable4").PivotFields("UWI").PivotItems("Item2").Visible = False

View 2 Replies View Related

VBA To Capture Filter Value From Pivot Table

Jun 23, 2014

I want my report title is more dynamic which is based on the pivot table's <Status Date> filter. It mean if I select the <Status Date> filter option as 6-23-2014. Then the report title will automatic update as "Statistic Report 6-23-2014" instead of I have to change the date each time I run the report.

View 1 Replies View Related

Looping Through Pivot Table Filter?

Aug 19, 2014

I am trying to loop through each pivot item in the pivot table filter called 'COMPANY_NAME'

This is the code I have so far but get an error on line 'PvItemL.Visible = False'

[Code]......

View 6 Replies View Related

VBA Pivot Table Filter Using EOMONTH

Oct 12, 2011

I have this code for setting a filter on my pivot table to show all data occuring after a certain date. Is there a way to add code so that instead of it saying "Value1:="31/10/2011"" that it would work out the last day of the current month and use that.

Something like:

Code:
=EOMONTH(TODAY(),0)

Code:
ActiveSheet.PivotTables("PivotTable1").PivotFields("Date_CDD").PivotFilters. _
Add Type:=xlAfter, Value1:="31/10/2011"
Sheets("SRS Pivot").Select

View 2 Replies View Related

Filter Pivot Table On Property Via VBA?

Oct 20, 2011

I need to filter a pivot table based on a field property. Sort of strange, but the database I get the PivotTable data from returns the Week in the accounting month. as the field name. It has several properties which I have figured out how to expose including the period end date. Now I need to figure out how to filter the PT based on that.

The following shows the property:

Code:
ActiveSheet.PivotTables("PivotTable4").CubeFields("[Time]").AddMemberPropertyField Property:="[Time].[Week in Month].[End Date]

Now if I just knew how to filter with that value I could move on the the next issue ....

View 2 Replies View Related

Auto Filter Pivot Table?

Mar 8, 2012

I have a summary worksheet, which has a drop down cell. on another tab I have a few pivot tables, is there a way I could get one of the pivot tables to auto filter based on the selection in the summary worksheet?

View 1 Replies View Related

Pivot Table Filter On Both Label And Value?

Apr 24, 2012

I have a pivot table, where the rows are product names, and there are two column fields: quantity and money.

I want to filter the pivot table to only show data where the amount of money equals zero. This is easily done with a Value Filter.

I also want to filter the pivot table to only show data as applicable to certain product names. This is easily done with Label Filter.

However, I cannot get both of these filters to stick at the same time. When I add one, the other is removed.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved