August 13, 2015 at 9:23 am
In my report I have created a summary of one of the values (Total_Progs) so that it will not count anything that contains ABC in the Factory field.
=Sum(IIf(Fields!Factory.Value <> "ABC", Fields!Total_Progs.Value,0))
I also have another field called Anotherfield that contains a summary where the Factory value does not contain ABC
Sum(IIf(Fields!Factory.Value <> "ABC", Fields!Anotherfield.Value,0))
I want to be able to divide the two columns to show a percentage, can anyone tell me how this would be done in SSRS.
August 13, 2015 at 9:34 am
Might be as simple as
=Sum(IIf(Fields!Factory.Value <> "ABC", Fields!Total_Progs.Value,0))/Sum(IIf(Fields!Factory.Value <> "ABC", Fields!Anotherfield.Value,0))
If you need the total size of Total_Progs/(Total_Progs + Factory), you would have to alter it a little.
Note, you will have to check the denominator for zero or you'll get a division error.
If this doesn't work for you, could you provide a few more details... like the structure of the dataset you're using in your report? (Just basic structure and maybe some sample data... as a union query... and an expected output.
August 13, 2015 at 12:02 pm
When I enter the following code into the syntax, the red line is displayed under the code
=Sum(IIf(Fields!Factory.Value [highlight=#ffff11]<[/highlight]> "ABC", Fields!Total_Progs.Value,0))/Sum(IIf(Fields!Factory.Value <> "ABC", Fields!Anotherfield.Value,0))
When I run the report I receive the warning,
An error occurred during local report processing
The value expression for the textrun 'Texbox...] contains an error BC30451 'It' iis not declared. It may be inaccessible due to protection level.
August 13, 2015 at 2:12 pm
oh, that's <> (not equal), the formatting stuff here screwed it up.
August 13, 2015 at 2:33 pm
Excellent, it worked but is displaying an incorrect value.
August 13, 2015 at 2:51 pm
Not enough information. What do you mean by "incorrect"? Is this a matrix or a table? What did you expect vs what you got?
got sample data?
August 13, 2015 at 2:57 pm
It does work, apologies, I was adding the wrong values!!! They were very similar fields!!! Spent an hour looking at it and it was something so simple arrgggh!!
August 13, 2015 at 3:38 pm
Ouch! I hate it when I do that... reminds me of the Far Side cartoon... "Thag, take napkin, have mammoth on face."
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply