We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Year and Quater column for date column in PivotTable

Good day,

I need to export a plain Excel table with several columns. Based on this table I want to build a Pivot table on the second sheet. One of the columns has dates. If I add this field in the list of Pivot fields manually in Excel, also two additional columns for year and quater are selected as rows.

How can I achieve this with XlsIo?


                var pivotSheet = workbook.Worksheets[0];

                IPivotCache cache = workbook.PivotCaches.Add(sheet.Range[1, 1, row - 1, maxCol]);

                IPivotTable pivotTable = pivotSheet.PivotTables.Add("PivotTable1", pivotSheet["A1"], cache);

                pivotTable.Fields[1].Axis = PivotAxisTypes.Row; // Created <- the date column

                pivotTable.Fields[2].Axis = PivotAxisTypes.Page; // Costcenter

                pivotTable.Fields[10].Axis = PivotAxisTypes.Row; // Creator

                pivotTable.Fields[17].Axis = PivotAxisTypes.Column; // Status

                var iDField = pivotTable.Fields[0];

                pivotTable.DataFields.Add(iDField, "Count", PivotSubtotalTypes.Count);




3 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 19, 2023 01:10 PM UTC

Christian, as of now Syncfusion XlsIO do not have support for adding quarters and years. We will analyze on providing support for this and will share you the details in 2 business days, on January 23rd, 2023.

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 23, 2023 05:19 PM UTC

Sorry Christian.

We are still analyzing on providing support and will share further details on January 25th, 2023.

We appreciate your patience.

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 25, 2023 04:47 PM UTC

Christian, we have logged a feature report to provide Support for Quarters and Years field for Date field in pivot table but do not have any immediate plans to implement this feature in near future.

You can track the status of this feature report through below feedback link.


Live Chat Icon For mobile
Up arrow icon