Selecting the DataRange of a Pivot Table

ddawg

New Member
Joined
Feb 10, 2015
Messages
1
Looking for some help from Excel Pivot Table DAX specialists. I'm attempting to access a range of data in a pivot table originating from an OLAP data source. I can't quite get what I need.

The VBA code accesses the entire DataRange for a PivotItem I would like to access a subset of that DataRange - only the Dividends column, for instance.

The following code:
Code:
Private Sub CommandButton1_Click()

Dim pivotTable As String: pivotTable = "SegmentedReturns"
Dim pivotField As String: pivotField = "[Account Activities].[Fully Qualified Symbol].[Fully Qualified Symbol]"

Dim pt As pivotTable
Set pt = ActiveSheet.PivotTables(pivotTable)

Dim pf As pivotField
Set pf = pt.PivotFields(pivotField)

Dim rng As Range
Set rng = pf.PivotItems(1).DataRange
rng.Select

End Sub

Does this:

What_it_Does.png


But what I want to do is access a subset of data as shown:

What_I_want_it_to_do.png


Any help is greatly appreciated.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
it's not clear to me this is a "DAX" question? I suspect the folks on the "main" forum might have more experience using vba to mess w/ pivot tables.
 
Upvote 0

Forum statistics

Threads
1,224,065
Messages
6,176,169
Members
452,710
Latest member
mrmatt36

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