The KPI works in preview mode but does not work in publish mode. How can it be corrected?

The KPI works in preview mode but does not work in publish mode. How can it be corrected?

This problem occurs if the KPI is made to refer to a specific aggregate table, which sometimes might not be correct. To solve the problem, remove the force aggregate option for the KPI and the problem should be fixed.