Max Valune using Pivot

Forestq

Active Member
Joined
May 9, 2010
Messages
482
Hi,

please help me modify my pivot:
- in this moment I shows "xxx ID" with section for "Published" and "Due Date"
Code:
Sub CreatePivotTable()
 
    Dim PTcache As PivotCache
    Dim PT As PivotTable
 
    Application.ScreenUpdating = False
 
    On Error Resume Next
    Application.DisplayAlerts = False
    Sheets("PivotSheet").Delete
    On Error GoTo 0
 
    Set PTcache = ActiveWorkbook.PivotCaches.Create( _
       SourceType:=xlDatabase, _
       SourceData:=Range("A1").CurrentRegion.Address)
 
    Worksheets.Add
    ActiveSheet.Name = "PivotSheet"
    ActiveWindow.DisplayGridlines = False
 
    Set PT = ActiveSheet.PivotTables.Add( _
      PivotCache:=PTcache, _
      TableDestination:=Range("A1"), _
      TableName:="ABC")
 
    With PT
        .PivotFields("xxx ID").Orientation = xlPageField 'sortowanie, filtrowanie, pokazanie 1 recordu
 
        .PivotFields("xxx ID").Orientation = xlRowField 'wyswietlanie wszystkich recordow
        .PivotFields("xxx ID").Position = 1
 
        .PivotFields("Published").Orientation = xlRowField
        .PivotFields("Published").Position = 2
 
        .PivotFields("Due Date").Orientation = xlRowField
        .PivotFields("Due Date").Position = 3
 
        .RowAxisLayout xlTabularRow
        Columns("B:B").EntireColumn.AutoFit
        Columns("C:C").EntireColumn.AutoFit
        Columns("A:A").EntireColumn.AutoFit
 
 
        ActiveSheet.PivotTables("ABC").PivotFields("xxx ID").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
 
        ActiveSheet.PivotTables("ABC").PivotFields("Published").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
 
        ActiveSheet.PivotTables("ABC").PivotFields("Due Date").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
 
               .DisplayFieldCaptions = True
 
    End With
 
 
End Sub

I just want in "Due Date" shows ONLY MAX "DUE DATE" (should be one value).
In this moment I see all available value.

regards,
PvK
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Re: Max Value using Pivot

Hi,

please help me modify my pivot:
- in this moment I shows "xxx ID" with section for "Published" and "Due Date"
Code:
Sub CreatePivotTable()
 
    Dim PTcache As PivotCache
    Dim PT As PivotTable
 
    Application.ScreenUpdating = False
 
    On Error Resume Next
    Application.DisplayAlerts = False
    Sheets("PivotSheet").Delete
    On Error GoTo 0
 
    Set PTcache = ActiveWorkbook.PivotCaches.Create( _
       SourceType:=xlDatabase, _
       SourceData:=Range("A1").CurrentRegion.Address)
 
    Worksheets.Add
    ActiveSheet.Name = "PivotSheet"
    ActiveWindow.DisplayGridlines = False
 
    Set PT = ActiveSheet.PivotTables.Add( _
      PivotCache:=PTcache, _
      TableDestination:=Range("A1"), _
      TableName:="ABC")
 
    With PT
        .PivotFields("xxx ID").Orientation = xlPageField 'sortowanie, filtrowanie, pokazanie 1 recordu
 
        .PivotFields("xxx ID").Orientation = xlRowField 'wyswietlanie wszystkich recordow
        .PivotFields("xxx ID").Position = 1
 
        .PivotFields("Published").Orientation = xlRowField
        .PivotFields("Published").Position = 2
 
        .PivotFields("Due Date").Orientation = xlRowField
        .PivotFields("Due Date").Position = 3
 
        .RowAxisLayout xlTabularRow
        Columns("B:B").EntireColumn.AutoFit
        Columns("C:C").EntireColumn.AutoFit
        Columns("A:A").EntireColumn.AutoFit
 
 
        ActiveSheet.PivotTables("ABC").PivotFields("xxx ID").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
 
        ActiveSheet.PivotTables("ABC").PivotFields("Published").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
 
        ActiveSheet.PivotTables("ABC").PivotFields("Due Date").Subtotals = _
        Array(False, False, False, False, False, False, False, False, False, False, False, False)
 
               .DisplayFieldCaptions = True
 
    End With
 
 
End Sub

I just want in "Due Date" shows ONLY MAX "DUE DATE" (should be one value).
In this moment I see all available value.

regards,
PvK[/QUOTE]
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,136
Members
452,890
Latest member
Nikhil Ramesh

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