简体   繁体   中英

SSRS Count and Expression function

I am trying to count the number of packages which belong to the Area by using the count. Every Area has different number of Packages.

How can I use Count here and check how many packages for a specific Area. Also there is a attribute called 'Delivered' with defined values as D,N,P. I want to check and calculate how much percentage of packages are in state 'D'.

Can anyone help. I tried using the count but no luck. =Count(Fields!Delivered.Value = 'D')

To get a count of specific records you can use something like this.

= SUM(Fields!Area.Value = "abc", 1, 0)

To get a percentage of the Delivered field do something like

=Sum(IIF(Fields!Delivered.Value = 1, 1, 0), "DataSet1")
 / Count(Fields!Delivered.Value , "DataSet1")

Make sure you change DataSet1 to match the dataset that the Delivered field comes form (you must include the quotes)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM