Note that there are some explanatory texts on larger screens.

plurals
  1. POPower Pivot Table - Looping through Fields in Report Filters
    primarykey
    data
    text
    <p><strong>Disclaimer</strong>: This question was posted in <a href="http://social.msdn.microsoft.com/Forums/office/en-US/811016c5-04ac-45c6-be0a-09aace0f6a7b/pivot-table-looping-through-fields-in-report-filters" rel="noreferrer">msdn forum</a> but since I didn't get any reply (surprisingly), I am cross posting it here as well. You might want to check that link before you try to attempt this question. I wouldn't want you to waste your time if a solution was posted in that link :)</p> <p><strong>Problem</strong>: I want to find out the field names in the Report Filter. So I am looking for <code>RegionCountryName</code>, <code>Cityname</code> and <code>ProductKey</code>. The Report Filters are dynamic and can change. </p> <p><strong>Screenshot</strong>:</p> <p><img src="https://i.stack.imgur.com/MtySH.png" alt="enter image description here"></p> <p><strong>What have I tried</strong>: I have checked every property of the Power Pivot but there is no property that I could find which would let me loop through the fields of the power pivot.</p> <p>I have even tried this code but it apparently give me an error on <code>Set pf = pt.PageFields(1)</code></p> <pre><code>Sub Sample() Dim pt As PivotTable, pi As PivotItem, pf As PivotField Dim lLoop As Long Set pt = Sheet1.PivotTables(1) Set pf = pt.PageFields(1) For Each pi In pf.PivotItems Debug.Print pi.Name Next pi End Sub </code></pre> <p><strong>Error ScreenShot</strong></p> <p><img src="https://i.stack.imgur.com/yJ5yR.png" alt="enter image description here"></p> <p>So what am I missing? Or is there a different approach that I should take?</p> <p><strong>EDIT</strong></p> <p>If someone wants to experiment with it, the file can be downloaded from <a href="http://www.microsoft.com/en-gb/download/details.aspx?id=11597" rel="noreferrer">HERE</a> I am looking at the <code>Inventory</code> Sheet.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload