0

So I have a report that looks like this enter image description here

I am trying to add a percentage of total in the last column that works the same way the current Total is working right now. For instance nest to the total for email I would like to see 88% (Total types, 214 emails divided by the Total of 244). How do I do that in SSRS? Here is the groupings

enter image description here

Anthony
  • 913
  • 3
  • 23
  • 32
  • 1
    I think it would be something along the lines of =IIF(COUNT(Customer,"dsMain") =0 , 0 ,Count(Customer,"Employee") / COUNT(Customer,"dsMain")) – Ross Bush Nov 15 '17 at 19:44

1 Answers1

1

Basically it should look something like this.

=SWITCH (
        Count(Fields!Customer.Value) = 0, 0 ,
        True, Count(Fields!Customer.Value, "Type")/Count(Fields!Customer.Value, "Employee")
        )

I'm using SWITCH here as it stops evaluateing when the first true condition is met, if not you can run into divide by zero issues.

So, we're saying.... if the count of the customer fields is zero then just return 0, then the True just acts like an else it catches anything not caught by any previous condition/result pairs. So if we have something to count then count the number of non-NULL values in the Type group and divide by the number of non-NULL values at the employee level (in the Employee group scope).

There is no need to multiple the result up by 100, all you need to do is format the cell as P0 or P2 or however many decimal places you want to show. So in your case the returned value would be 0.87704 but would be formatted assuming you used p1, as "87.7%"

Alan Schofield
  • 19,839
  • 3
  • 22
  • 35