mdeheus90
mdeheus90

Reputation: 25

SSRS count if > 0 Expression

I'm trying to build a report but am stuck on an expression that feels simple but I can't figure out. I've been going through different possible solutions but nothing has worked. What I need is the following:

I have a database that holds transport orders, some of these transport orders match with others. My goal is to show, per customer, on one side a count the total amount of transport orders (By postID) and on the same row the count (By postID) of orders where the "Matchcount" > 0.

I managed to show total count of orders and total sum of matches.

I tried the following formula but that did not work. Please Help!!

=count(IIf(Fields!Sum_Potential_Match_Count.Value > 0, Fields!PostStatusID.Value,0))

View on how the report should be built:

Upvotes: 1

Views: 5463

Answers (1)

iamdave
iamdave

Reputation: 12243

Count simply counts the rows that are returned. As far as I am aware you can't filter as you are trying to do.

Instead, you can use =sum(iif(Fields!Sum_Potential_Match_Count.Value > 0, 1,0))


Oh do you want to sum up the values in Sum_Potential_Match_Count? In that case you can just sum on the field?

=sum(Fields!Sum_Potential_Match_Count.Value)

Upvotes: 2

Related Questions