简体   繁体   English

SSRS Report Builder - 如何计算日期差异并在 2 个数据集之间添加 IFF 语句

[英]SSRS Report Builder - How to calculate the date diff and add IFF statement between 2 data sets

I am trying to calculate the difference in days between 2 data sets and then if the value is between 1 and 2 days then it should show compliant if the value is a negative number or greater than 2 days I want it to show non-compliant.我正在尝试计算 2 个数据集之间的天数差异,然后如果该值介于 1 到 2 天之间,那么如果该值是负数或大于 2 天,它应该显示合规我希望它显示不合规。 I am not sure what I have wrong, it runs however they all show compliant我不确定我有什么问题,它运行但是它们都显示合规

Background on the calculation needed.所需计算的背景。 IMM Discharge compliance - Hospitals must deliver a copy of the signed notice to each beneficiary not more than two (2) days before the day of discharge. IMM 出院合规性 - 医院必须在出院前不超过两 (2) 天向每位受益人提供一份已签署的通知副本。 Follow-up notice is not required if delivery of the initial IM falls within two (2) calendar days of discharge.如果初始 IM 在出院后两 (2) 个日历日内交付,则不需要后续通知。

FYI - the first IFF statement is because some do not have dates so that was to account for those仅供参考 - 第一个 IFF 声明是因为有些没有日期,所以这是为了说明那些

=IIF(
    IsNothing(Lookup(Fields!Account_Number.Value,Fields!Account_Number.Value,Fields!Intervention_Date_Of_Service.Value, "Interventions")), 
    "No Intervention", 
    IIF(
        DateDiff("d",Fields!Actual_Discharge_Date.Value,Lookup(Fields!Account_Number.Value,Fields!Account_Number.Value,Fields!Intervention_Date_Of_Service.Value, "Interventions")) <=2,
        "Compliant",
        "Non-compliant")
    )

I have tried multiple variations =1 or 2, etc if I use just the =2 they all show non-compliant我尝试了多种变体 =1 或 2 等,如果我只使用 =2,它们都显示不合规

You have two conditions for non-compliance - the difference being negative or greater than 2 days so you have to check both conditions.您有两个不合规条件 - 差异为负数或大于 2 天,因此您必须检查这两个条件。 Try something like this:尝试这样的事情:

=IIF(IsNothing(Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")), 
    "No Intervention", 
    IIF(DateDiff(DateInterval.Day, Fields!Actual_Discharge_Date.Value, Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")) < 1,
        "Non-compliant", 
        IIF(DateDiff(DateInterval.Day, Fields!Actual_Discharge_Date.Value, Lookup(Fields!Account_Number.Value, Fields!Account_Number.Value, Fields!Intervention_Date_Of_Service.Value, "Interventions")) > 2,
            "Non-compliant",
            "Compliant" 
        )
    )
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM