I have been using powershell to generate a pivot table based on disk space report.Below is the part of the script which I am using to generate the pivot table
# Get sheets
$ws3 = $workbook.worksheets | where {$_.name -eq "DiskInformation"} #<------- Selects sheet 3
$xlPivotTableVersion12 = 3
$xlPivotTableVersion10 = 1
$xlCount = -4112
$xlDescending = 2
$xlDatabase = 1
$xlHidden = 0
$xlRowField = 1
$xlColumnField = 2
$xlPageField = 3
$xlDataField = 4
$xlDirection = [Microsoft.Office.Interop.Excel.XLDirection]
# R1C1 means Row 1 Column 1 or "A1"
# R65536C5 means Row 65536 Column E or "E65536"
$range1=$ws3.range("A1")
$range1=$ws3.Range($range1,$range1.End($xlDirection::xlDown))
$range2=$ws3.range("H1")
$range2=$ws3.Range($range2,$range2.End($xlDirection::xlDown))
$selection = $ws3.Range($range1, $range2)
#Write-Host "R2:"$range2
$PivotTable = $workbook.PivotCaches().Create($xlDatabase,$selection,$xlPivotTableVersion10)
$PivotTable.CreatePivotTable("R6C1","Tables1") | Out-Null
[void]$ws3.Select()
#$ws3.Cells.Item(3,1).Select()
$workbook.ShowPivotTableFieldList = $true
$PivotFields = $ws3.PivotTables("Tables1").PivotFields("Environment")
$PivotFields.Orientation = $xlColumnField
$PivotFields = $ws3.PivotTables("Tables1").PivotFields("Used Capacity(GB)")
$PivotFields.Orientation = $xlDataField
$PivotFields = $ws3.PivotTables("Tables1").PivotFields("Free Space(GB)")
$PivotFields.Orientation = $xlDataField
$PivotFields = $ws3.PivotTables("Tables1").PivotFields("Farms/Classification")
$PivotFields.Orientation = $xlRowField
Above script was taken from enter link description here
Above code works perfectly fine and it generates the report,however it generates a summation row "Values" which I need it to be in Columns section. Please find the screenshot below on how it looks currently
Can you please tell me how to move the auto generated field "Values" from Rows to column section?
For any future references, the following code worked for me