pdp
pdp

Reputation: 11

SSRS 2008 R2 - Rowcount based on column values

I'm using SSRS 2008 R2, need help with rowcount or count function. Basically I have a report that has a column called Days and the value is difference between two specific dates....some of the values can be O or less if the order was shipped before the committed ship date... so in the result set I have total of 11 rows, out of those 11 rows, 3 rows have value of 0 or less.. I need an expression that gives me the count of 3.. Thank you for help in advance.

Upvotes: 0

Views: 140

Answers (1)

Michael
Michael

Reputation: 1596

Your formula should be:

=SUM(iif(Fields!CommittedDate.Value > Fields!ShippedDate.Value,1,0)

That being said, why don't we move this back into the dataset (assuming SQL)?

...
, CASE WHEN CommittedDate > ShippedDate THEN 1 ELSE 0 END as EarlyShipment
...

Then you could just sum or count the result of EarlyShipment in your report.

It's a best practice to move logic like this back into dataset itself in case you would like to reference it elsewhere in the report.

Let me know if I have understood your problem correctly.

Upvotes: 1

Related Questions