Options
sql reporting help count(iif()
I'm creating a report in visual studio for ssrs and I cant figure out why the expression below isn't counting all of my records correctly.
It doesnt count any record that is "Accounting" in the description column but it counts all the other strings. I'm pretty sure I didn't misspell Accounting, and that's how it looks in the record when the query is ran. Thoughts?
EDIT: I've even tried CStr, InStr, Trim against "Accounting"...
= "Total Cases: " & CountDistinct(Fields!case_sk.Value) & vbcrlf & "Total Active Cases: " & Count(iif(Fields!description.Value = "Accounting" OR Fields!description.Value = "Accounting - Subrogation" OR Fields!description.Value = "Accounting - Medicare" OR Fields!description.Value = "Petition for Minor's Comp.",1,Nothing))
It doesnt count any record that is "Accounting" in the description column but it counts all the other strings. I'm pretty sure I didn't misspell Accounting, and that's how it looks in the record when the query is ran. Thoughts?
EDIT: I've even tried CStr, InStr, Trim against "Accounting"...
Comments
-
OptionsRobertKaucher Member Posts: 4,299 ■■■■■■■■■■Have you tried using something like Fields!description.Contains?
-
Optionsphoeneous Member Posts: 2,333 ■■■■■■■□□□The only choices I have are:
Value
IsMissing
UniqueName
Color
FontFamily
FontSize
FontWeight
FontStyle
TextDecoration
FormattedValue
Key
LevelNumber
ParentUniqueName -
OptionsRobertKaucher Member Posts: 4,299 ■■■■■■■■■■I suck at RS.
What about just adding this as a field to your query using the T-SQL COUNT function? -
Optionsphoeneous Member Posts: 2,333 ■■■■■■■□□□It already is, I just need to count specific strings that are retrieved in the description column. Whats weird is it will count correctly for all of the other strings except "accounting". Strange.