implementing new DB call for calculating KPIs