简体   繁体   English

使用EPPlus将自定义数据字段添加到excel数据透视表

[英]Adding Custom Data fields to an excel Pivot Table Using EPPlus

I have created a Pivot Table on a worksheet using EPPlus and want to add a custom data field programatically. 我已经使用EPPlus在工作表上创建了数据透视表,并希望以编程方式添加自定义数据字段。 How would one go about doing this? 人们将如何去做呢?

My pivot table consists of: 我的数据透视表包括:

Columns : Years, 列:年,

Rows : Companies, 行:公司,

Data : currently a sum of the revenues for each year 数据:目前每年的总收入

I would like to add a column which gives the revenue for each company as 'Year to date' ie the last 12 months from the current point in time. 我想添加一列,将每个公司的收入表示为“年初至今”,即距当前时间点的最近12个月。

In the end I added an additional field which flagged whether that particular bit of data had been created since the beginning of the same year. 最后,我添加了一个附加字段,用于标记自同一年开始以来是否已创建该特定数据位。 I then Filtered on this flag. 然后,我过滤了此标志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM