SSRS表达式,用于与数字的日期差

问题描述 投票:0回答:1

我有这个表情:

=COUNT(Fields!RecId.Value) - 
IIF(Fields!Status.Value="Assigned", 
    DATEDIFF("d", Fields!CreatedDateTime.Value,Fields!ResolvedDateTime.Value), 
    DATEDIFF("d", Fields!CreatedDateTime.Value,Fields!AssignedDateTime.Value)) 
- IIF(Weekday(Parameters!StartDate.Value, 1) = 1, 1, 0)
- IIF(Weekday(Parameters!StartDate.Value, 1) = 7, 1, 0)
- IIF(Weekday(Parameters!EndDate.Value, 1) = 1, 1, 0)
- IIF(Weekday(Parameters!EndDate.Value, 1) = 7, 1, 0)

如果日期超过1天,我想返回的是RecID值减去日期差。

ssrs-2012
1个回答
0
投票

根据评论,您似乎想要记录数减去记录数,即创建日期与工作状态之间的工作日,如果状态为“已分配”,则为已解决日期,否则为已分配日期。

=COUNT(Fields!RecId.Value) - 
SUM(
    IIF(Fields!Status.Value = "Assigned", 
        IIF(DATEDIFF("d", Fields!CreatedDateTime.Value, Fields!ResolvedDateTime.Value)
        - (DateDiff(DateInterval.WeekOfYear, Fields!CreatedDateTime.Value, Fields!ResolvedDateTime.Value)*2)
        - (IIF(WEEKDAY(Fields!CreatedDateTime.Value) = 7, 1, 0)
        - (IIF(WEEKDAY(Fields!ResolvedDateTime.Value) = 6, 1, 0)) 
        - 1) > 1, 0, 1)
        , 
        IIF(DATEDIFF("d", Fields!CreatedDateTime.Value, Fields!AssignedDateTime.Value) > 1, 0, 1)
        - (DateDiff(DateInterval.WeekOfYear, Fields!CreatedDateTime.Value, Fields!AssignedDateTime.Value) * 2)
        - (IIF(WEEKDAY(Fields!CreatedDateTime.Value) = 7, 1, 0)
        - (IIF(WEEKDAY(Fields!AssignedDateTime.Value) = 6, 1, 0)) 
        - 1) > 1, 0, 1)
    )
© www.soinside.com 2019 - 2024. All rights reserved.