Hello,
I have a Pivot table as below:
I have 2 questions:
Please provide some sample.
<SfPivotView TValue="StockStatus" ShowFieldList=true ShowGroupingBar="true">
<PivotViewDataSourceSettings DataSource="@datasource">
<PivotViewColumns>
<PivotViewColumn Name="ReportDate"></PivotViewColumn>
</PivotViewColumns>
<PivotViewValues>
<PivotViewValue Name="Qty" Type=SummaryTypes.PercentageOfColumnTotal Caption="Qty"></PivotViewValue>
</PivotViewValues>
<PivotViewRows>
<PivotViewRow Name="StockStatus"></PivotViewRow>
</PivotViewRows>
<PivotViewFormatSettings>
<PivotViewFormatSetting Name="ReportDate" Type="FormatType.DateTime" Format="MMM-yy"></PivotViewFormatSetting>
</PivotViewFormatSettings>
<PivotViewFilterSettings>
<PivotViewFilterSetting Name="Year" Type=Syncfusion.Blazor.PivotView.FilterType.Date Items="@(new string[] { "> 2022-01-01" })">
</PivotViewFilterSetting>
</PivotViewFilterSettings>
<PivotViewDisplayOption View=View.Table></PivotViewDisplayOption>
</PivotViewDataSourceSettings>
</SfPivotView>
Hi Sao,
Please find the response below:
Query |
Comments |
||
Is it possible to use a single date field to display the year, month, and day in separate columns?
|
Yes, You can group the date field into years, months and days in code-behind by using "PivotViewGroupSettings". Please refer the below code examples.
Code example:
You can also group the date field into years, months and days using Grouping UI. Please refer the below code example and screenshot. Code example:
Screenshot: Output screenshot: |
||
Would it be possible to prefilter the data 12 months back from today's date?
|
You can set the range for the date field in code-behind by using "PivotViewGroupSettings". Also you can set the range in Grouping UI too. Please refer the below code examples.
Code example:
|
Meanwhile we have prepared a sample for your reference.
Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/PivotTable-607751418
Please refer the following document link to know more about Grouping feature.
Document : https://blazor.syncfusion.com/documentation/pivot-table/grouping#group-interval
Please let us know if you have any concerns.
Regards,
Angelin Faith Sheeba.