Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Add-OfficeExcelReportKpi

Aliases: ExcelReportKpi
Module
PSWriteOffice
Aliases
ExcelReportKpi
Inputs
System.Object

Adds a row of KPI cards.

Syntax

Add-OfficeExcelReportKpi
[-InputObject] <Object>
[-LabelFillColor <OfficeColor>]
[-PassThru]
[-PerRow <Int32>]
[<CommonParameters>]
#
Parameter set: Default

Examples

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 requiredposition: 0pipeline: True (ByValue)
Objects, dictionaries or native tabular data supplied directly or through the pipeline.
-LabelFillColor OfficeColor optional
Optional fill color for KPI labels.
-PassThru SwitchParameter optional
Emits the native result after the operation.
-PerRow Int32 optional
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.