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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
VinitGohil1976
Frequent Visitor

Comparing Dates between two different tables

I am trying to create a new custom measure that will compare two dates from two different tables. This is how the model has been defined

 

VinitGohil1976_0-1743429292556.png

I need to compare the Agreement[Agreement Activated Date] to the Policy Date which is a calculated column with the following definition:

 

Policy Date = IF(ISBLANK(Policy[Policy Start Date]), DATE(1900, 1, 1), Policy[Policy Start Date]).
I created this MaxDatemeasure but i dont think this actually compares the activated and start dates by row
 VinitGohil1976_2-1743429585604.png
VinitGohil1976_1-1743429501053.png

Is there a way to compare the dates by row so that it can take the maximum of the two dates on the row and uses that to set as the new maxdate?

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a calculated column in the agreement snapshot fact table like

Cancellation Due Date =
MAX (
    RELATED ( Agreement[AgreementActivatedDate] ),
    RELATED ( Policy[Policy Date] )
) + 60

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

You could create a calculated column in the agreement snapshot fact table like

Cancellation Due Date =
MAX (
    RELATED ( Agreement[AgreementActivatedDate] ),
    RELATED ( Policy[Policy Date] )
) + 60
Deku
Super User
Super User

Max( max( Agreement[Agreement Activated Date]), max(Policy[Policy Date]))


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

That also causes the same issue. I am basically trying to define this Sql logic in Power Bi

 

date_add(IF(pol.PolicyStartDate > agr.AgreementActivatedDate, pol.PolicyStartDate, agr.AgreementActivatedDate), 60) as CancellationDueDate
 
I tried with IF clauses and SWITCH statements also but i think the issue is more with the model than it is with the dates. If there are any further suggestions, i am willing to try any... thanks

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors