Forum Discussion

Switto's avatar
Switto
Helper IV
6 years ago
Solved

Datediff with IF condition

Hi All,

I am trying to find aging between On hold cases and responded cases(Approved or Rejected).

 

Most of the time, cases go without hold so no date will be provided for that particular line item.

 

I have "On hold" date, on the date, which the item has been put on hold.

 

Hold cases can be "Approve" or "Reject" or kept on hold for resolution(so no date). We can have only an Approved date or Rejected Date for each line item.

 

I have given the Datediff however it is not working as expected. I have tried the logic in excel and it works perfectly.

 

Please see the formula:

Aging Days = IF(ISBLANK(BELGIUM_AML_LIST[OnHoldDate]),0,

IF(AND(ISBLANK(BELGIUM_AML_LIST[ApprovedafterconsultationDate]),BELGIUM_AML_LIST[Resettodraftafterconsultation]),

         DATEDIFF(BELGIUM_AML_LIST[OnHoldDate].[Date],BELGIUM_AML_LIST[Today].[Date],DAY),

IF(ISBLANK(BELGIUM_AML_LIST[ApprovedafterconsultationDate]),

         DATEDIFF(BELGIUM_AML_LIST[OnHoldDate].[Date],BELGIUM_AML_LIST[Resettodraftafterconsultation].Date],DAY),

              DATEDIFF(BELGIUM_AML_LIST[OnHoldDate].[Date],BELGIUM_AML_LIST[ApprovedafterconsultationDate].Date],DAY))))

 

Please see the screenshot:

 
  • Switto's avatar
    Switto
    6 years ago

    Thanks Amit for the response.

     

    However, I got the solution. I forgot to add ISBLANK in one of the lines.

     I got the desired result.

    Thanks for taking the time.

     

3 Replies

  • Switto ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

    • Switto's avatar
      Switto
      Helper IV

      Thanks Amit for the response.

       

      However, I got the solution. I forgot to add ISBLANK in one of the lines.

       I got the desired result.

      Thanks for taking the time.