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
szczepaneq
Regular Visitor

Date comparison beetwen 2 tables

Hello,

 

In my model I have 2 tables with purchase orders (from 2 different databases) and I need to compare Delivery dates.

 

I think, it's more complicated because, each purchase order has multiple lines of sale with different dates. For lets say PO 1234 we could have completely different dates for each line. Moreover, different amount of lines (not common).

 

I have relations based on Purchase order (many to many). Unfortunately, I don't have ID column on this tables (should I add it?).

 

szczepaneq_0-1636438849068.png

 

First of all, when I put data in table or matrix viz (Purchase order[table1], Delivery date[table1], Delivery date[tables2]) I have all possible combinations. If PO 1234 has 2 lines in table1 and 2 lines in table 2 with different dates -> then I see 4 rows in my visualitization. I'm able to compare quantities or amount of lines.

 

szczepaneq_1-1636438903221.png

 

If i try to use DATE.DIFF with RELATED as column or measure, it's not possible (don't recognize column from related table etc.)

 

I'm beginner and I will appreciate any suggestions. I was trying answer in existing topics but I didn't find. Thanks.

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @szczepaneq ,

 

Create a many to many relationship between two tables using [Purchase order]. But as you said if there's two rows in table1 and two rows in table2 and you don't have any other rows to identify the records, so there would be four rows to be shown.

 

Best Regards,

Jay

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

View solution in original post

4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @szczepaneq ,

 

Create a many to many relationship between two tables using [Purchase order]. But as you said if there's two rows in table1 and two rows in table2 and you don't have any other rows to identify the records, so there would be four rows to be shown.

 

Best Regards,

Jay

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

I have created new column "PO line" (based on chronological date) and with relation 1:1 the comparison is possible (using DATEDIFF function). Thanks.

amitchandak
Super User
Super User

@szczepaneq , do you have purchase order no, Line no, which can act as join to get all the dates ??

I have only Purchase Order no (which is duplicated if the Purchase order has >1 sale line) and any column like "line no". In both tables.

 

As below:

szczepaneq_0-1636443884620.png

 

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.