简体   繁体   English

SSRS 2012通过分组合并数据集

[英]SSRS 2012 merge datasets with grouping

Dataset 1 = reportable data 数据集1 =可报告的数据

可报告数据

Dataset 2 = lookup info 数据集2 =查找信息

查询信息

I am able to use Lookup for in order to "merge" their data into one table. 我可以使用Lookup以便将其数据“合并”到一个表中。 (from here: Joining two datasets to create a single tablix in report builder 3 ). (从这里开始: 在报表构建器3中将两个数据集连接起来以创建一个tablix )。 With the tablix pointed at Dataset1, the formula to get Location is: 在Tablix指向Dataset1的情况下,获取Location的公式为:

=Lookup(Fields!PersonId.Value, Fields!PersonId.Value, Fields!Location.Value, "Dataset2") =查阅(Fields!PersonId.Value,Fields!PersonId.Value,Fields!Location.Value,“ Dataset2”)

可以得到这张桌子

My problem comes from trying to take that one step further and applying a Row Group that relies on the data found from Dataset 2. 我的问题来自尝试进一步采取这一步骤,并应用依赖于从数据集2找到的数据的行组。

想要得到这张桌子

I am unable to re-design and somehow come up with a combined T-SQL query. 我无法重新设计,并且以某种方式提出了组合的T-SQL查询。 Dataset 1 is sourced from an SSAS MDX expression that is greater than 8,000 characters, and thus trying to manipulate that into SQL through OpenQuery fails because the command length is too large. 数据集1来自大于8,000个字符的SSAS MDX表达式,因此,由于命令长度太大,尝试通过OpenQuery将其操纵到SQL中失败了。

I am also unable to flip around the datasets and have Dataset 2 be the driver for the report layout and do lookups on Dataset 1. Dataset 2 will not have context to the list of PersonId's from Dataset 1 and thus has many more rows than would be necessary. 我也无法翻转数据集,而让数据集2成为报表布局的驱动程序并在数据集1上进行查找。数据集2将不具有数据集1的PersonId列表的上下文,因此其行数要多得多必要。 The lookup must come from Dataset 1. 查找必须来自数据集1。

Thank you for your time and advice! 感谢您的时间和建议!

Turns out there is no problem at all when applying grouping via Lookup on Dataset 2. My issue was user error; 事实证明,通过“数据集2”上的“查找”应用分组时根本没有问题。 I forgot to add ".Value" to the first field. 我忘了在第一个字段中添加“ .Value”。

Bad: =Lookup(Fields!PersonId, Fields!PersonId.Value, Fields!Location.Value, "Dataset2") 错误:=查找(Fields!PersonId,Fields!PersonId.Value,Fields!Location.Value,“ Dataset2”)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM