add kpi analysis function