Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Count Function In Reporting Services


Count Function In Reporting Services

Author
Message
tt-615680
tt-615680
Old Hand
Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)

Group: General Forum Members
Points: 334 Visits: 1201
Dear All,

I'm trying to do a simple query where I want to count a Column with a Dataset but its not working for some reason. I'm using the following query:
Count(Fields!columnname.Value, "Dataset1")


Thank you in advance!
Gazareth
Gazareth
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2875 Visits: 5362
Hi, how is it not working - error, wrong count, something else?

Cheers
Gaz
tt-615680
tt-615680
Old Hand
Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)Old Hand (334 reputation)

Group: General Forum Members
Points: 334 Visits: 1201
Gazareth (3/1/2013)
Hi, how is it not working - error, wrong count, something else?

Cheers
Gaz



Thank you for your reply!

I now changed the expression to =CountDistinct(Fields!columnname.Value) but I get the following results:


Year Count %Var

2000 1
1

2001 1
1
1
1

2002 1
1
1
1
1
1

But I need the total per year to be added together.

Thank you!
Gazareth
Gazareth
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2875 Visits: 5362
Hi, yeah CountDistinct will do that, if every value in the column is the same, which it looks like it is (year?).
One solution would be to change the column in your expression to one that's unique in every row, and that you can guarantee it always will (else future counts could be wrong), or go back to using just Count - still not sure what was wrong with that first time around :-)

Cherrs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search