![](/img/trans.png)
[英]SSRS - Creating a calculated field (subtract one group value from its next) based on Column and Row Regions
[英]SSRS - Group set of rows based on calculated value from the row's data
我想基於對一行列數據之一的計算來對一組行進行分組(顯示)。
可以說我Tablix中有3列。 1.說明2.金額3.借方/貸方
根據D / C值,我想對金額進行總計(對於其借方-ve和貸方為+ ve),直到總數變為零,然后將這些行分組為不同的顏色或其他行之間的行間距行。
輸出示例:
謝謝
卡爾提克
我已經使用問題中提供的數據集重新創建了您的方案。 我正在使用“數量”單元格background-color
屬性將總和分組。
這是我創建的tablix。 所選單元格的背景屬性設置為一個表達式(如下所示):
在Report
菜單中, Report Properties...
/ Code
選項卡將此功能放在文本區域中。
Dim prevColor As String = "Red"
Dim accumulator As Double = 0
Public Function GetSumColor(ByVal value as Double) as String
Dim color As String
accumulator = accumulator + value
color = prevColor
If accumulator = 0 Then
If prevColor = "Red" Then
prevColor = "Yellow"
Else
prevColor = "Red"
End If
End If
Return color
End Function
此功能將根據等於零的總和在Red
或Yellow
之間更改單元格背景顏色(您可以使用所需的任何顏色)。
在“數量”單元格background-color屬性中,使用以下表達式:
=Code.GetSumColor(
IIF(Fields!D_C.Value="C",-Fields!Amount.Value,Fields!Amount.Value)
)
它將產生以下結果:
讓我知道這是否對您有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.