我想在日期范围内做一个条件格式。因此,如果日期开始/结束范围(在参数@Begin
和@End
中选择)在5到7天之间,则显示“周”,如果 between 28 days and 31 days
,显示"Month"
,其他所有内容,显示"X days"
等
我有这样的东西,但语法上没有计算。我正在努力解决这个问题,所以任何人都可以帮助或指出我正确的方向吗?
我拥有的例子;
=Iif(Parameters!DateBegin.Value = today() AND Parameters!DateEnd.Value = Today(), "Today", Iif(Parameters!DateBegin.Value = DateAdd("d",-1,Today()) AND Parameters!DateEnd.Value = Today(), "Yesterday", Iif(Parameters!DateBegin.Value AND Parameters!DateEnd.Value *difference is BETWEEN 5-7 days*, "Week", Iif(Parameters!DateBegin.Value AND Parameters!DateEnd.Value *difference is BETWEEN 28-31 days*, "Month", Everything else = *difference BETWEEN* Parameters!DateBegin.Value AND Parameters!DateEnd.Value & "days"
我如何实现这一目标? :)
答案 0 :(得分:0)
听起来你正在寻找DATEDIFF()
功能。
例如(5-7天):
Iif(
(DateDiff("d", Parameters!DateBegin.Value, Parameters!DateEnd.Value) > 4) AND (DateDiff("d", Parameters!DateBegin.Value, Parameters!DateEnd.Value) < 8), "Week", [etc]