我有一个大的SSRS报告,我试图从多个字段中获取最大值。现在我让IIF在两个日期之间获取MAX值,但我想要报告中所有字段的MAX值。这是我必须在2个值之间获取MAX
=IIF(((IIF(Fields!OnOrder1Day.Value<Fields!Sold1Day.Value,
Fields!Sold1Day.Value, Fields!OnOrder1Day.Value) +
IIF(Fields!OnOrder2Day.Value<Fields!Sold2Day.Value, Fields!Sold2Day.Value,
Fields!OnOrder2Day.Value) +
IIF(Fields!OnOrder3Day.Value<Fields!Sold3Day.Value, Fields!Sold3Day.Value,
Fields!OnOrder3Day.Value)) - (Fields!lonhand.Value -
Fields!OnOrderToday.Value)-Fields!onpo.Value)<0, 0,
((IIF(Fields!OnOrder1Day.Value<Fields!Sold1Day.Value, Fields!Sold1Day.Value,
Fields!OnOrder1Day.Value) +
IIF(Fields!OnOrder2Day.Value<Fields!Sold2Day.Value, Fields!Sold2Day.Value,
Fields!OnOrder2Day.Value) +
IIF(Fields!OnOrder3Day.Value<Fields!Sold3Day.Value, Fields!Sold3Day.Value,
Fields!OnOrder3Day.Value)) - (Fields!lonhand.Value -
Fields!OnOrderToday.Value)-Fields!onpo.Value))
我想要做的是从以下所有字段中找到MAX:
Fields!OnOrder1Day.Value
Fields!Sold1Day.Value
Fields!OnOrder2Day.Value
Fields!Sold2Day.Value
Fields!OnOrder3Day.Value
Fields!Sold3Day.Value
Fields!OnOrder4Day.Value
Fields!Sold4Day.Value
Fields!OnOrder5Day.Value
Fields!Sold5Day.Value
Fields!OnOrder6Day.Value
Fields!Sold6Day.Value
是否可以执行类似
的操作MAX(Fields!OnOrder1Day.Value,Fields!Sold1Day.Value,Fields!OnOrder2Day.Value,Fields!Sold2Day.Value,Fields!OnOrder3Day.Value,Fields!Sold3Day.Value,Fields!OnOrder4Day.Value,Fields!Sold4Day.Value,Fields!OnOrder5Day.Value,Fields!Sold5Day.Value,Fields!OnOrder6Day.Value,Fields!Sold6Day.Value)
答案 0 :(得分:0)
如果我理解正确,您需要数据集中多个字段的最高值。基本上,你想要最大的最大值。它可以使用嵌入式IIF的负载和负载,只是包子中的疼痛。
IIF(
(MAX(Fields!OnOrder1Day.Value) > MAX(Fields!OnOrder2Day.Value)) AND
(MAX(Fields!OnOrder1Day.Value) > MAX(Fields!OnOrder3Day.Value)) *ETC*,
Fields!OnOrder1Day.Value,
IIF(
(MAX(Fields!OnOrder2Day.Value) > MAX(Fields!OnOrder1Day.Value)) AND
(MAX(Fields!OnOrder2Day.Value) > MAX(Fields!OnOrder3Day.Value)) *ETC*,
MAX(Fields!OnOrder2Day.Value,
IIF( *ETC*),
),
)
答案 1 :(得分:0)
您可以添加自定义功能,诸如此类
Public Function GetMaxDate(val1 as Date, val2 as Date) as Date
Return iif(val1 > val2, val1, val2)
End Function
并在您的表达式中使用它
=Code.GetMaxDate(Code.GetMaxDate(Code.GetMaxDate(Code.GetMaxDate(Max(Fields!OnOrder1Day.Value),
Max(Fields!Sold1Day.Value)
),
Max(Fields!OnOrder2Day.Value)
),
Max(Fields!OnOrder2Day.Value)
),
Max(Fields!OnOrder3Day.Value)
)
等
或根据需要定义其他任何函数参数