It sounds like you may be running in to some of the common issues around grand totals. This thread may help you determine the underlying issue.
Sensitivity of the data aside, the fact that they are SQL-sourced should not make a difference. You can extract and package the workbook.
In any case, are the two fields [2017 Actual Payroll]/[2017 Sales] in the same data source, or are you blending data on this view?
If they are the same data source, what happens when you use the formula SUM([2017 Actual Payroll])/SUM([2017 Sales]) as Payroll to Sales Ratio without the if statement?