I am trying to calculate a variance percentage and avoid dividing by 0 errors

This code below works for the overall variance percentage

```
=IIf(Sum(Fields!Baseline.Value) = 0, 0, Sum(Fields!test.Value))  / IIf(Sum(Fields!Baseline.Value) = 0, 1, Sum(Fields!Baseline.Value))

```

I am now trying to limit it to a certain category and tried using the below expression

```
    =IIF(Fields!Category.Value = "Resources Capital ",
IIf(Sum(Fields!Baseline.Value) = 0, 0, Sum(Fields!test.Value))
  / IIf(Sum(Fields!Baseline.Value) = 0, 1, Sum(Fields!Baseline.Value)), 0)

```

It does not appear to be looking at the category value as it continues to give me the overall variance. Any help would be appreciated as I am not sure where to go from here.