Forum Discussion

HabibAdil's avatar
HabibAdil
Icon for Helper IV rankHelper IV
6 years ago

Datediff with Many to Many Relationship

Hi All, 

I am struggling to get the number of calender days between two dates using the datediff function with aggregation. I have done similar thing in the past but the tables had one to many relationship (https://community.powerbi.com/t5/Desktop/Enquiry-Response-Time-using-Datediff-where-the-Dates-are-in/m-p/1009183#M478038). Attached is some sample data.

 

I am trying to calculate how late or early a SO line was delivered. If a SO line was delivered in two different batches i.e. not delivered in full, then we are using the latest date for calculation  as can be seen for SO A and Line 1.

Thanks for your help!!!

4 Replies

    • HabibAdil's avatar
      HabibAdil
      Icon for Helper IV rankHelper IV

      Hi Greg_Deckler Thanks for your quick response. I tried that, but SO No is a string and SO Line is a whole number. I get an error. The SO NO is not always a number, but could have characters, hence I cannot change it to a number.