我正在尝试通过销售人员为客户创建老化报告。我有客户群,然后是该群组中的所有客户。我正在尝试计算由于老化桶的数量为< 30,介于31和60之间,介于61和90之间,以及> 90。
我的SQL视图会将表格中的帐单年龄计算为 OverDueDays ,并将帐单总计计算为 AmountDC 。
我为< 30桶提出了以下内容,但它没有显示正确的值。
=IIF(Fields!OverDueDays.Value<30 , Sum(Fields!AmountDC.Value),0)
关于我做错了什么的想法?
答案 0 :(得分:2)
我暂时没有使用Reporting Services,因此语法可能不是100%正确。基本上,您想要切换SUM和IIF的顺序。尝试类似:
=SUM(IIF(Fields!OverDueDays.Value < 30, Fields!AmountDC.Value, 0))
奖励:如果您想计算一个桶中的客户数量:
=SUM(IIF(Fields!OverDueDays.Value < 30, 1, 0))
答案 1 :(得分:0)
如果您有多个数据集,请尝试以下表达式:
=IIF(DateDiff("d", First(Fields!OrderDate.Value, "Invoice"), Now())<=0, RunningValue(Fields!LineAmount.Value, Sum, "Invoice"), 0)
=IIF(DateDiff("d", First(Fields!OrderDate.Value, "Invoice"), now())>=1 and DateDiff("d", First(Fields!OrderDate.Value, "Invoice"),Now())<=30, RunningValue(Fields!LineAmount.Value, Sum, "Invoice"), 0)
=IIF(DateDiff("d", First(Fields!OrderDate.Value, "Invoice"), now())>=31 and DateDiff("d", First(Fields!OrderDate.Value, "Invoice"),Now())<=60, RunningValue(Fields!LineAmount.Value, Sum, "Invoice"), 0)
=IIF(DateDiff("d", First(Fields!OrderDate.Value, "Invoice"), now())>=61 and DateDiff("d", First(Fields!OrderDate.Value, "Invoice"),Now())<=90, RunningValue(Fields!LineAmount.Value, Sum, "Invoice"), 0)
=IIF(DateDiff("d", First(Fields!OrderDate.Value, "Invoice"), now())>=91, RunningValue(Fields!LineAmount.Value, Sum, "Invoice"), 0)