0

我有从 2 个数据集生成策略数量的报告。

该表链接到 dataset1。

我用了公式

CountDistinct(Fields!Policy_ID.Value)

我的问题是如何从第二个数据集“AccountingV10Dataset”中获取字段 Policy_ID 的不同计数,特别是我将 Contract_Start_Month、Contract_Cover_Type 和 Primary_LOB 分组。

下面是报告设计的屏幕截图,以帮助您了解我的要求 在此处输入图像描述

该报告应按如下方式生成: 在此处输入图像描述

4

2 回答 2

0

我会在数据集层(例如在 SQL 中)得出不同的计数。SSRS 聚合函数仅此而已。

于 2013-03-10T23:08:30.147 回答
0

我设法以这种方式解决:

我创建了以下代码来计算来自另一个数据集的区分计数:

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")

希望我的解决方案能像对我一样对其他用户有所帮助。

问候,

于 2013-03-13T09:35:11.430 回答