2016-07-29 129 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;