Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
HabibAdil
Helper IV
Helper IV

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...). 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.

Days Diff.PNG

Thanks for your help!!!

4 REPLIES 4
Greg_Deckler
Super User
Super User

You can't create a composite key using [So No] & [So Line No] ?

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

I'm not sure what the issue is @HabibAdil I have attached an example file where I concatenate a text column and a numeric column.

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you @Greg_Deckler 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.