2016-08-01 104 views
0

我正在創建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 

我在「城市」有一個COUNT和城市和鄉村進行分組。這是我想它出現

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

然而,這是它是如何出現

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

所以我需要一羣以累計總額列,也爲了通過列,但不知道如何去做吧。所有幫助表示感謝,謝謝。

已嘗試Sanjays回答下面,除非我做錯了我得到這個錯誤。

enter image description here

+1

對於你的新錯誤,它看起來像你把**排序**表達式放在**表**中,而不是**組**。您只能在集團級別使用聚合功能。轉到組屬性並在其中添加排序(右鍵單擊您的組並單擊**行組** - > **組屬性**)並從表中刪除它。 **組**屬性彈出窗口看起來與**表**屬性相同。 –

+0

謝謝漢諾威,你是對的我正在把桌子上的排序 – whitz11

回答

1

這裏 我們需要創建一個城市和國家的組和刪除行組細節部分像下面

enter image description here

所以表的樣子上述前後發生了改變

enter image description here

and s等計數(場!ID.Value, 「CITY」) SD排序表達式第一組city1與順序Z到A

enter image description here

+0

在這裏我的小組表達式是在組列不在桌子上我清楚地附加在圖像中。所以你可以右鍵單擊組表達式並設置排序表達式。 –

+0

謝謝桑傑,這確實有效,我做錯了 – whitz11

1

有多種方式,你可以去這個問題。一種選擇是處理查詢中的分組,並簡單地在SSRS中顯示結果。所以,你的查詢將是這個樣子:

SELECT ID, City, Country, COUNT(*) as Total 
FROM MyTable 
GROUP BY ID, City, Country 

現在在SSRS您可以通過Total列,因爲它沒有被報告彙總排序。