Search code examples
matrixreporting-servicesssrs-2008reportingssrs-2012

how to add percentage column in ssrs


I have a matrix in report builder to generate for each employee the actual balance per Fiscal_year where fiscal_year is columns group.

I need to add a field to calculate YOY% between years selected in the parameters for example if i selected in parameters Fiscal_year 2018, 2017, I should have in addition to 2018 actual balance, and 2017 actual balance, YOY% = (2018 AB -2017 AB)/2017 AB

The formula should take into consideration dividing by zero.

enter image description here enter image description here


Solution

  • I solved it using the below formula, it also take into consideration dividing by zero:

    =IIF(SUM(iif(Fields!FISCAL_YEAR.Value = 2017,cdbl(Fields!actual_BAL.Value),0.00))=0,0,(SUM(iif(Fields!FISCAL_YEAR.Value = 2018,cdbl(Fields!actual_BAL.Value),0.00))-SUM(iif(Fields!FISCAL_YEAR.Value = 2017,cdbl(Fields!actual_BAL.Value),0.00)))/IIF(SUM(iif(Fields!FISCAL_YEAR.Value = 2017,cdbl(Fields!actual_BAL.Value),0.00))=0,1,SUM(iif(Fields!FISCAL_YEAR.Value = 2017,cdbl(Fields!actual_BAL.Value),0.00))))*100