获取报表中计算列(总计)的 Max() 值

Get the Max() value of calculated columns (totals) in a report

我正在尝试获取列 Max 的值,它是列 ABC 的最大值。行 TGTotalGrand total (因为行组),我只需要它们的最大值:

-----------------------------
         A    B    C  | Max   
-----------------------------
      |  1    1    2  |      
-----------------------------
      |  2    1    3  |      
------+---------------+------
   T  |  3    2    5  |  5   
------+---------------+------
      |  2    5    1  |      
-----------------------------
      |  1    2    1  |      
------+---------------+------
   T  |  3    7    2  |  7   
------+---------------+------
   G  |  6    9    7  |  9   
-----------------------------

每当我尝试使用 Max() 函数时,我都会收到类似 The expression of [...] uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in the headers and footers..

的错误

在 MS Excel 中,我会在 Max 列中简单地执行 MAX(A1:C1)。有什么解决方案可以在 rdlc 中实现这一点吗?

我已经搜索了上面的错误并找到了 this answer,但是第一个选项是不可能的,第二个选项..好吧,我不是很明白,我认为它不适用于 Max。如果是的话,你能解释一下我应该把解决方法放在哪里吗?

我正在使用 Visual Studio 2015 和 Microsoft.ReportViewer.WebForms v10.0.0.0.

它需要将这段代码放在 "T" 和 "G" 行的字段 "Max" 中。它应该可以工作。我没试过 ;)

If Sum(Fields!A.Value) >= Sum(Fields!B.Value) And Sum(Fields!A.Value) >= Sum(Fields!C.Value) Then
    Sum(Fields!A.Value) 
Else if Sum(Fields!B.Value) >= Sum(Fields!A.Value) And Sum(Fields!B.Value) >=  Sum(Fields!C.Value) Then
    Sum(Fields!B.Value) 
Else
    Sum(Fields!C.Value) 
End If


update after the comment of KevinM

IIf ( 
      Sum(Fields!A.Value) >= Sum(Fields!B.Value) And Sum(Fields!A.Value) >= Sum(Fields!C.Value)
      , Sum(Fields!A.Value)
      , ( 
         IIf (Sum(Fields!B.Value) >= Sum(Fields!A.Value) And Sum(Fields!B.Value) >=  Sum(Fields!C.Value)
        ,    Sum(Fields!B.Value)
        , Sum(Fields!C.Value)
      ) 
    )