如何在 SSRS 分组中获取特定的单元格值?
How to get specific cell value in SSRS grouping?
我正在使用 SQL Server Report Builder 制作 SSRS 报告。我的列和行分组如下:
我想选择下面红框中突出显示的行。如何访问该特定单元格并在报告中的其他 table 中显示其值?如您所见,我要访问的值是列分组总数。
由于您想要的单元格没有特定的设计时名称,您将无法直接引用它。您必须重新计算第二个 table 中的值。您必须确定标准,但假设它始终是上一个财政年度并且特定 = 固定百分比...那么...
你应该可以用类似(未测试)...
=SUM(IIF(Fields!FiscalYear.Value = Last(Fields!FiscalYear.Value) AND Fields!.Particular.Value = "Fixed Percentage of Gross Income [c=(axb)]", Fields!Value.Value,0))
使用自定义代码:
Function SumLookup(ByVal items As Object()) As Decimal
If items Is Nothing Then
Return Nothing
End If
Dim suma As Decimal = New Decimal()
Dim ct as Integer = New Integer()
suma = 0
For Each item As Object In items
suma += Convert.ToDecimal(item)
Next
return suma
End Function
然后在要引用值的单元格中:
=Code.Sumlookup(lookupset("2073/074",Fields!FiscalYear.Value,Fields!Value.Value,"DataSet"))
*
lookup("2073/074",Fields!FiscalYear.Value,Fields!Alfa.Value,"DataSet"))
我正在使用 SQL Server Report Builder 制作 SSRS 报告。我的列和行分组如下:
我想选择下面红框中突出显示的行。如何访问该特定单元格并在报告中的其他 table 中显示其值?如您所见,我要访问的值是列分组总数。
由于您想要的单元格没有特定的设计时名称,您将无法直接引用它。您必须重新计算第二个 table 中的值。您必须确定标准,但假设它始终是上一个财政年度并且特定 = 固定百分比...那么...
你应该可以用类似(未测试)...
=SUM(IIF(Fields!FiscalYear.Value = Last(Fields!FiscalYear.Value) AND Fields!.Particular.Value = "Fixed Percentage of Gross Income [c=(axb)]", Fields!Value.Value,0))
使用自定义代码:
Function SumLookup(ByVal items As Object()) As Decimal
If items Is Nothing Then
Return Nothing
End If
Dim suma As Decimal = New Decimal()
Dim ct as Integer = New Integer()
suma = 0
For Each item As Object In items
suma += Convert.ToDecimal(item)
Next
return suma
End Function
然后在要引用值的单元格中:
=Code.Sumlookup(lookupset("2073/074",Fields!FiscalYear.Value,Fields!Value.Value,"DataSet"))
*
lookup("2073/074",Fields!FiscalYear.Value,Fields!Alfa.Value,"DataSet"))