2016-07-29 97 views
0

您好,希望您能帮助。计算SSRS表中的出现次数

在SSRS上工作。有以下数据集。

ID  City  Country 
1  London  England 
2  Glasgow Scotland 
3  Aberdeen Scotland 
4  Swansea Wales 
5  London  England 
6  Glasgow Scotland 
7  Glasgow Scotland 
8  Manchester England 

想要一个表,按城市分组,并显示每个城市有多少次事件,请参见下面的内容?

City   Country  Total 
    Glasgow  Scotland  3 
    London  England  2 
    Manchester England  1 
    Swansea  Wales   1 
    Aberdeen  Scotland  1 

请问我该怎么办?

回答

2

创造City使用一组下面的表达式后:

=COUNT(Fields!City.Value,"City") 

让我知道,如果这有助于。

+0

感谢alejandro,帮助很大 – whitz11

2

从您的问题看来,您不希望报告中的详细信息,只有摘要数据。如果你确实需要细节,Alejandro Zuleta的答案将会奏效。如果您不需要详细信息,则可以在数据集中进行分组:

select city, country, count(*) as total 
    from <yourtable> 
group by city, country;