ExcelScript.ShowAsCalculation enum
DataPivotField 的 ShowAs 计算函数。
注解
示例
/**
* The script changes the display for "Crates Sold at Farm".
* It shows the percentage of the grand total,
* instead of the default sum.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the PivotTable named "Farm Pivot".
const farmPivot = workbook.getPivotTable("Farm Pivot");
// Get the data hierarchy "Sum of Crates Sold at Farm".
const farmSales = farmPivot.getDataHierarchy("Sum of Crates Sold at Farm");
// Show the data as a percentage of the grand total.
farmSales.setShowAs({
calculation: ExcelScript.ShowAsCalculation.percentOfGrandTotal
});
}
字段
differenceFrom | 与指定的基字段和基项的差异。 |
index | 按如下所示计算值:单元格中的 ( (值) x (总计) ) / ( (大行总计) x (大列总计) ) |
none | 不应用任何计算。 |
percentDifferenceFrom | 与指定的基字段和基项的差异。 |
percentOf | 指定基字段和基项的百分比。 |
percentOfColumnTotal | 列总数的百分比。 |
percentOfGrandTotal | 占总计的百分比。 |
percentOfParentColumnTotal | 指定基字段的列总数的百分比。 |
percentOfParentRowTotal | 指定基字段的行总数的百分比。 |
percentOfParentTotal | 指定基字段的总和的百分比。 |
percentOfRowTotal | 占行总数的百分比。 |
percentRunningTotal | 指定基字段的总运行百分比。 |
rankAscending | 指定基字段的升序排名。 |
rankDecending | 指定基字段的降序排名。 |
runningTotal | 运行指定基字段的总计。 |
unknown | 计算未知或不受支持。 |