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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Ttaylor9870
Helper III
Helper III

Date in one table is greater than date in another

Hey All, Good Afternoon!

 

Just wondering has anyone ever came across this before. How would I go about comparing is the date in for exmaple tbl_1[Date Secured] is before tbl_2[Date Recieved]. Result should return true or false.

 

Both tables linked by a Sales_ID field.

 

Any help would be greatly appreicated! 🙂

 

Many Thanks,

 

Taylor

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Ttaylor9870 ,

Have you solved your problem?
If not, please try this DAX to create a new column:

DateComparisonResult = 
VAR RelatedDateReceived = RELATED(tbl_2[Date Recieved])
RETURN IF(tbl_1[Date Secured] < RelatedDateReceived, TRUE, FALSE)

The result is as follows:

vjunyantmsft_0-1703663481102.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Ttaylor9870 ,

Have you solved your problem?
If not, please try this DAX to create a new column:

DateComparisonResult = 
VAR RelatedDateReceived = RELATED(tbl_2[Date Recieved])
RETURN IF(tbl_1[Date Secured] < RelatedDateReceived, TRUE, FALSE)

The result is as follows:

vjunyantmsft_0-1703663481102.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@Ttaylor9870 

Provide the context, is the measure you are creating or a column? Some details will help

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

@Fowmy 

 

See example below...
tbl_1

Sales_IDDate Secured
1234511/11/2023
1234612/11/2023
1234713/11/2023

 

tbl_2...

Sales_IDDate Recieved
1234512/11/2023
1234613/11/2023
1234713/11/2023

 

Both table above will be linked by the Sales_ID column tbl_1 being the fact table & tbl_2 being the dimension table. This is also just random sample data.

All I'd like to do is write a meausre or column whatever works so I can display if tbl_1[Date Secured] is before tbl_2[Date Recieved] or not. 🙂

 

Many Thanks,

 

Taylor

I think this will work as a measure:

 

VAR tbl = SUMMARIZE (
    Sales,
    Sales[Sales_ID],
    "IsBefore",
        IF (
            INT ( MAX (tbl_1[Date Secured]) - MAX (tbl_2[Date Recieved]) ) < 0,
            1,
           0
        )
)
RETURN
MAXX(
tbl, [Isbefore])

 

It returns a 1 if it is, 0 if it isn't.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.