Reporting services 来自另一个具有多个分组的数据集的disctinctcount

Reporting services 来自另一个具有多个分组的数据集的disctinctcount,reporting-services,ssrs-2008,Reporting Services,Ssrs 2008,我有一个从2个数据集生成多个策略的报告 该表链接到数据集1 我用了这个公式 CountDistinct(Fields!Policy_ID.Value) 我的问题是如何从第二个数据集“AccountingV10Dataset”中获取字段策略ID的不同计数,特别是我有分组合同开始月、合同覆盖类型和主LOB 下面是报告设计的屏幕截图,以帮助您理解我的请求 报告应按以下方式生成: 我将在数据集层(如SQL)中导出不同的倒计时。SSRS聚合函数仅此而已。我设法以这种方式解决了这个问题: 我创建了以下代

我有一个从2个数据集生成多个策略的报告

该表链接到数据集1

我用了这个公式

CountDistinct(Fields!Policy_ID.Value)
我的问题是如何从第二个数据集“AccountingV10Dataset”中获取字段策略ID的不同计数,特别是我有分组合同开始月、合同覆盖类型和主LOB

下面是报告设计的屏幕截图,以帮助您理解我的请求

报告应按以下方式生成:

我将在数据集层(如SQL)中导出不同的倒计时。SSRS聚合函数仅此而已。

我设法以这种方式解决了这个问题:

我创建了以下代码来计算与另一个数据集的距离计数:

Dim suma As Decimal = New Decimal()

Public Function SumLookup(ByVal items As Object(),ByVal CountSum As String) As Decimal
If items Is Nothing Then
Return Nothing
End If

Dim ct as Integer = New Integer()
Dim PolId as Integer = New Integer()
suma = 0
ct = 0
PolId = 0
For Each item As Object In items
suma += Convert.ToDecimal(item)
If (CountSum = "SUM") then
ct += 1
Else If (PolID <> Convert.ToInt32(item)) then 
ct += 1
END If
PolId = Convert.ToInt32(item)
Next
If (ct = 0) Then return 0 else If(CountSum = "SUM") then return suma else return ct 
End Function


Public Function GetMyVal() as Decimal
GetMyVal = suma 
End Function
希望我的解决方案能像对我一样对其他用户有所帮助

问候,

=code.SumLookup(Lookupset(Fields!Contract_Start_Month.Value & "-" & Fields!Contract_Cover_Type.Value & "-" & Fields!Primary_LOB.Value,Fields!Contract_Year_Start_Month.Value & "-" & Fields!Cover_Type.Value & "-" & Fields!LOB.Value,Fields!Layer_ID.Value, "AccountingV10Dataset"),"COUNT")