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
schoden
Post Partisan
Post Partisan

DateDIFF between multilpe tables /Cross tables

Hi experts, 

 

HOw Can I achieve DATEDIFF between different tables as shown.  RELATED function is not working.DateDIFF.png

 

 

Vendor_Invoice_Date in Table2 and Date_invoice in Table 1. 

13 REPLIES 13
v-lili6-msft
Community Support
Community Support

HI @schoden 

For your case, you may just use this simple formula to create a new column

Column = DATEDIFF(Table1[Date_invoice],CALCULATE(MAX(Table2[Vendor_Invoice_Date])),DAY)

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft 

Thank for the reply.....It almost matched but some didnt show correct figure as shownClose.JPG

hi @schoden 

If so, since in your model, between the two date, relationship is like man to many, I would suggest you create a measure instead of column as below

Measure = DATEDIFF(CALCULATE(MAX(Table1[Date_invoice])),CALCULATE(MAX(Table2[Vendor_Invoice_Date])),DAY)

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft With this measure the query takes times to load., the dotted circle keeps on circling.

 

amitchandak
Super User
Super User

@amitchandak  Thanks as always but since my two wanted tables has no common field to link , it is difficult to use the formula

 

😞

@schoden , there need to be some common ground to take diff.

tex628
Community Champion
Community Champion

If there is no common field to link, how do you know which date is related to which? 

/ J


Connect on LinkedIn

@tex628as you can see in the picture , it gets linked by 3 tables inbetween those two table1 and table 2.

tex628
Community Champion
Community Champion

In this table:

image.png

Does the related() work if you try and create two columns for the dates?

/J


Connect on LinkedIn

@tex628Can you explain more, which table should I create the the date column.    Becuase using RELATED function in table1 can pick automatically only table around it, that is the 3 tables linked to it but not the bridge/joining tables.

 

 

 

 

 

tex628
Community Champion
Community Champion

You need to create the column in the brdigetable

image.png


Connect on LinkedIn

@tex628  Oki I will try to implement in the bridge table..and get back to you soon

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.