SSRS Count IF Multiple Values

I am creating an education report. I have a bunch of grades and I would like to summarize the number of grades A - C. Something like

SUM WHERE Grades IN ('A', 'B', 'C') 

How to do this in an expression? Can I make a SUM on output or something like that? I tried =SUM(Choose(1, "A", "B", "C")) , but I could not get it to work.

+6
source share
2 answers

You need to combine the Sum statement with a conditional expression of type IIf :

 =Sum( IIf(Fields!Grades.Value = "A" or Fields!Grades.Value = "B" or Fields!Grades.Value = "C" , 1 , 0) ) 

Thus, the counter is only included in Sum , if Grades is A or B or C.

+18
source

I think you need to replace 0 Nothing. as shown below

 =Sum( IIf(Fields!Grades.Value = "A" or Fields!Grades.Value = "B" or Fields!Grades.Value = "C" ,1 ,Nothing) ) 

Then you should be good to go.

0
source

Source: https://habr.com/ru/post/970941/


All Articles