使用SSRS 2008R2。如何選擇符合行組的「First(Fields ...)」和「Last(Fields ..)」之間的行值?
目前,我有一個select語句查詢幾個表並返回一堆分層數據。
1 Store-> 1+節 - > 1 +項目
返回的數據集類似於這樣的事情(加上其他20列):
Store_num | Section_num | Section_Name | Year_Calc | Item_name | Item_Num
4542 | 32 | Fruits | 1 | Apple | 1
4542 | 32 | Fruits | 2 | Apple | 1
4542 | 32 | Fruits | 3 | Apple | 1
4542 | 32 | Fruits | 4 | Apple | 1
4542 | 32 | Fruits | 5 | Apple | 1
4542 | 32 | Fruits | 1 | Berry | 2
4542 | 32 | Fruits | 2 | Berry | 2
4542 | 32 | Fruits | 3 | Berry | 2
4542 | 32 | Fruits | 4 | Berry | 2
4542 | 32 | Fruits | 5 | Berry | 2
4542 | 32 | Fruits | 1 | Orange | 3
4542 | 32 | Fruits | 2 | Orange | 3
4542 | 32 | Fruits | 3 | Orange | 3
4542 | 32 | Fruits | 4 | Orange | 3
4542 | 32 | Fruits | 5 | Orange | 3
4542 | 32 | Fruits | 1 | Banana | 4
4542 | 32 | Fruits | 2 | Banana | 4
4542 | 32 | Fruits | 3 | Banana | 4
4542 | 32 | Fruits | 4 | Banana | 4
4542 | 32 | Fruits | 5 | Banana | 4
4542 | 32 | Fruits | 1 | Watermelon | 5
4542 | 32 | Fruits | 2 | Watermelon | 5
4542 | 32 | Fruits | 3 | Watermelon | 5
4542 | 32 | Fruits | 4 | Watermelon | 5
4542 | 32 | Fruits | 5 | Watermelon | 5
4542 | 33 | Vegetables | 1 | Esparagus | 12
4542 | 33 | Vegetables | 2 | Esparagus | 12
4542 | 33 | Vegetables | 3 | Esparagus | 12
4542 | 33 | Vegetables | 4 | Esparagus | 12
4542 | 33 | Vegetables | 5 | Esparagus | 12
4542 | 33 | Vegetables | 1 | Lettuce | 13
4542 | 33 | Vegetables | 2 | Lettuce | 13
4542 | 33 | Vegetables | 3 | Lettuce | 13
4542 | 33 | Vegetables | 4 | Lettuce | 13
4542 | 33 | Vegetables | 5 | Lettuce | 13
4542 | 33 | Vegetables | 1 | Mushroom | 14
4542 | 33 | Vegetables | 2 | Mushroom | 14
4542 | 33 | Vegetables | 3 | Mushroom | 14
4542 | 33 | Vegetables | 4 | Mushroom | 14
4542 | 33 | Vegetables | 5 | Mushroom | 14
4542 | 33 | Vegetables | 1 | Tomato | 15
4542 | 33 | Vegetables | 2 | Tomato | 15
4542 | 33 | Vegetables | 3 | Tomato | 15
4542 | 33 | Vegetables | 4 | Tomato | 15
4542 | 33 | Vegetables | 5 | Tomato | 15
4542 | 33 | Vegetables | 1 | Spinach | 16
4542 | 33 | Vegetables | 2 | Spinach | 16
4542 | 33 | Vegetables | 3 | Spinach | 16
4542 | 33 | Vegetables | 4 | Spinach | 16
4542 | 33 | Vegetables | 5 | Spinach | 16
在我的表矩陣,我目前正在分組在Items_num和Section_num上,以便爲每個部分的每個項目重複我的整個Tablix。
起初這不是一個難題,因爲我剛創建了兩個tablix,而多年的一個有一個列組。問題解決了。
但是,和其他工作一樣,這還不夠好。我需要爲每個「5年計算」重複所有的信息數據。
下面是tablix的樣子,你會明白爲什麼我不能找出一個好的解決方案。
+--------+--------+----------------+-------------+---------+---------+----------------+
|Store |4542 |Store Name: | We Sell Groceries! |
+--------+--------+----------------+-------------+---------+---------+----------------+
|Section |32 |Section Name:| Fruits |
+--------+--------+----------------+-------------+---------+---------+----------------+
|Item |1 |Item Name: | Apple |
+--------+--------+----------------+-------------+---------+---------+----------------+
| |First(Year) |2nd(Year) |3rd(Year)|4th(Year)|Last(Year) |
+-----------------+----------------+-------------+---------+---------+----------------+
|Calculation 1 |First(Column_10)| | | |Last(Column_10) |
+-----------------+----------------+-------------+---------+---------+----------------+
|Calculation 2 |First(Column_11)| | | |Last(Column_11) |
+-----------------+----------------+-------------+---------+---------+----------------+
|Calculation 3 |First(Column_12)| | | |Last(Column_12) |
+-----------------+----------------+-------------+---------+---------+----------------+
|Calculation 4 |First(Column_13)| | | |Last(Column_13) |
+-----------------+----------------+-------------+---------+---------+----------------+
|Calculation 5 |First(Column_14)| | | |Last(Column_14) |
+-----------------+----------------+-------------+---------+---------+----------------+
|Calculation 6 |First(Column_15)| | | |Last(Column_15) |
+-----------------+----------------+-------------+---------+---------+----------------+
|Calculation 7 |First(Column_16)| | | |Last(Column_16) |
+-----------------+----------------+-------------+---------+---------+----------------+
我有5個靜態列,我無法想出一個辦法來從我的數據集「第2,第3和第4個」值。
使用查找功能不起作用,因爲它是對整個數據集,並且不堅持,我現在已經申請(對整個表矩陣)行組
任何想法?
爲什麼你要設置**第(列)**你不需要** First()**方法來顯示你的數據,你可以刪除第一個並檢查結果。讓我知道 –
首先返回「年」等於1時的值(對於某個部分中的每個項目)。誠然,沒有它仍然返回相同的價值,但這不是我遇到的問題。我在談論如何在Year = 2,3,4時獲得這些值。 – Christian