使用 SSRS 2008R2。
目前,我有一个查询几个表并返回一堆分层数据的 select 语句。
1 个商店-> 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
在我的 tablix 中,我目前正在对 Items_num 和 Section_num 进行分组,以便为每个 Section 的每个 Item 重复我的整个 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”值的方法。
使用 Lookup 函数不起作用,因为它在整个数据集上,并且不遵守我当前应用的行组(到整个 tablix)
有任何想法吗?