How to display date as MMM in pivot column

Hello,

How can I format the display of the  <PivotViewColumn Name="ReportDate"></PivotViewColumn> to display Name of Month (eg. Jan. Feb, mar etc) from a date column?


I have a Pivot Table below:


 <SfPivotView TValue="vUoMError" @ref="@pivot" AllowExcelExport=true Height="300">

            <PivotViewDataSourceSettings DataSource="@dataSource">

                <PivotViewFilters>

                    <PivotViewFilter Name="CSO"></PivotViewFilter>

                    <PivotViewFilter Name="FY"></PivotViewFilter>

                </PivotViewFilters>

                <PivotViewColumns>

                    <PivotViewColumn Name="ReportDate"></PivotViewColumn>

                    <PivotViewColumn Name="Qtr"></PivotViewColumn>

                </PivotViewColumns>

                <PivotViewRows>

                    <PivotViewRow Name="Level"></PivotViewRow>


                </PivotViewRows>

                <PivotViewValues>

                    <PivotViewValue Name="UoM_Error" Caption="Error"></PivotViewValue>

                    <PivotViewValue Name="Qty" Caption="Qty"></PivotViewValue>

                    <PivotViewValue Name="Divisor"></PivotViewValue>

                                   </PivotViewValues>

                <PivotViewFormatSettings>

                    <PivotViewFormatSetting Name="UoM_Error" Format="N"></PivotViewFormatSetting>

                </PivotViewFormatSettings>

            </PivotViewDataSourceSettings>

        </SfPivotView>




Best regards



1 Reply

AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team August 16, 2022 06:47 AM UTC

Hi Sao,


Using the PivotViewFormatSettings option, you can format the date type fields in the pivot table based on your requirement. Please refer the below code example.


Code Example:

<SfPivotView TValue="TemplateData" ID="PivotView" Height="400">

    <PivotViewDataSourceSettings DataSource="@pivotData">

       <PivotViewFormatSettings>

            <PivotViewFormatSetting Name="PowUnits" Type="FormatType.DateTime" Format="MMM"></PivotViewFormatSetting>

        </PivotViewFormatSettings>

    </PivotViewDataSourceSettings>

</SfPivotView>


Screenshot:


Meanwhile, we have prepared a sample for your reference.


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PivotTable707929670


Please refer the below UG document to know more about PivotViewFormatSettings property.


Document: https://blazor.syncfusion.com/documentation/pivot-table/number-formatting


Please let us know if you have any concerns.


Regards,

Angelin Faith Sheeba.


Loader.
Up arrow icon