Pivot table data item orientation

I am creating a pivot table with 1 row item, 1 column item, and 2 data items. The data items are oriented by row, but I would like them by column. (See the attached screen shot.) Could someone explain if this is possible?


Sample code:
table.AddFieldToArea(PivotFieldType.Row, “Date”)
table.AddFieldToArea(PivotFieldType.Column, “Name”)
table.AddFieldToArea(PivotFieldType.Data, “Primary”)
table.AddFieldToArea(PivotFieldType.Data, “Secondary”)

P.S. - I am able to do this in VBA with the following code:

With ActiveSheet.PivotTables(“Sheet2”).DataPivotField
.Orientation = xlColumnField
.Position = 2
End With

Hi,

Could you try the line of code if it works for your requirement, e.g


table.AddFieldToArea(PivotFieldType.Data, “Primary”)
table.AddFieldToArea(PivotFieldType.Data, “Secondary”)

table.AddFieldToArea(PivotFieldType.Column, table.DataField)


Thank you Amjad, your solution works!