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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Swiftglade
Frequent Visitor

Create column based on difference between two dates from two tables

Hi,

 

I am trying to create a Calculated column to track the difference between two dates from two different columns. The goal is to find when a shipment has been recieved (Final Merger) and when the product has been recieved and put away (Export Worksheet). I am trying to create a calcuated column using an if statement, however i run into the error.

 

The If statement is created within Export OR Final Merger

1. Wont allow me to select multiple tables in my If Statement. If I select either fields, I wont be able to select the other table.

2. Error - "Cannot Find (Column Name)

 

Tables 

 

TableColumnType
Final_MergerFirst DateDate
Export WorksheetSecond DateDate
Date DimensionDateDate

 

References 

First TableSecond TableColumn Relationship 
Final_MergerExport Worksheet
Receipt ID
Many to Many
Final MergerDate DimensionDateMany to One

 

 

2 REPLIES 2
Fowmy
Super User
Super User

@Swiftglade 

I suggest you avoid creating Many-to-Many relationships. If you can share the formula, it will be clear enough. 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy ,

Many to Many relationship comment- 

I will look into cleansing the data, but we recieve it with values that have duplicates, from Receipt ID to another version of Receipt ID. At the moment, we cannot cleanse it and must have it as Many-Many. 

 

Formula- 

We are trying to get the First Date from "Final Merger", and compare the date to Export Worksheet.
So for example, We have "Frist Date, which is June 23. We want to know the when the next workday is,
so we created a column in our Date Table to have the next work day.
We then want to compare if the date the product was received (Second Date) is on time or not on time.
Our goal was to do an Greater than if statement.

Another example below.

IF(Second Date>Next Workday),"Shipment has passed date","Shipment was received on time")

Final MergerExport Worksheet 
FirstInventory StoredNext Workday
2021-02-10 0:002021-02-11 0:002021-02-11 0:00

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.