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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

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
Community Champion
Community Champion

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


Follow on LinkedIn
@ 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!:
DAX For Humans

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.

 

 



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you @Greg_Deckler 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.