Cmdlet
Add-OfficeExcelReportKpi
Adds a row of KPI cards.
Syntax
Add-OfficeExcelReportKpi
[-InputObject] <Object>
[-LabelFillColor <OfficeColor>]
[-PassThru]
[-PerRow <Int32>]
[<CommonParameters>]#Parameter set:
DefaultExamples
Add a row of KPI cards
New-OfficeExcel -Path .\Reports\Operations.xlsx {
ExcelReportSheet 'Summary' {
ExcelReportKpi ([ordered]@{ Uptime = '99.97%'; Incidents = 4; Deployments = 37 })
}
}Shows three headline figures as KPI cards.
Compute KPIs from the data
$orders = Import-OfficeCsv -Path .\Data\Q3-Orders.csv
$kpis = [ordered]@{
Revenue = ($orders | Measure-Object Amount -Sum).Sum
Orders = $orders.Count
'Average order' = [math]::Round(($orders | Measure-Object Amount -Average).Average, 2)
'Active customers' = ($orders | Select-Object -ExpandProperty Customer -Unique).Count
}
New-OfficeExcel -Path .\Reports\Q3-Sales-Summary.xlsx {
ExcelReportSheet 'Summary' {
ExcelReportTitle 'Q3 sales' 'July to September 2026'
ExcelReportKpi $kpis -PerRow 4
}
}Calculates the sales KPIs from the order export and shows them four to a row.
Parameters
- -InputObject Object
- Objects, dictionaries or native tabular data supplied directly or through the pipeline.
- -LabelFillColor OfficeColor
- Optional fill color for KPI labels.
- -PassThru SwitchParameter
- Emits the native result after the operation.
- -PerRow Int32
- Number of KPI cards per rendered row.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.