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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

DAX Logic for Dates

Hello,

 

I am new to DAX functionality and I was wondering if there were functions and measures I could create to make the following psuedo code possible:

 

If (Table 1 Value exists in Table 2) {

If (Table 1 Value's Entry Date is after Table 2 Value's Entry Date) {

[Do Something]

}

}

 

The main issues I have are in regards to setting up the conditionals. Are there DAX functions to see if Values exist in different tables? And is there a logical comparison between dates to see if one date is after another date?

 

Thanks

1 REPLY 1
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

I tried to create a sample pbix file based on the explanation.

I am not sure whether I understood your question correctly, but please check the below picture and the sample pbix file.

 

Picture2.png

 

Table1 Value exists in Table2 =
IF (
ISFILTERED ( Dim_Values[Value] ),
SWITCH (
TRUE (),
SELECTEDVALUE ( Table1[Value] )
IN CALCULATETABLE ( VALUES ( Table2[Value] ), ALL ( Dim_Values ) )
&& SELECTEDVALUE ( Table1[Date] ) > SELECTEDVALUE ( Table2[Date] ), "Yes / later than table2",
SELECTEDVALUE ( Table1[Value] )
IN CALCULATETABLE ( VALUES ( Table2[Value] ), ALL ( Dim_Values ) )
&& SELECTEDVALUE ( Table1[Date] ) <= SELECTEDVALUE ( Table2[Date] ), "Yes / earlier(or equal) than table2",
SELECTEDVALUE ( Table1[Value] ) = BLANK ()
&& SELECTEDVALUE ( Table2[Value] ) <> BLANK (), "Only Table2",
NOT (
SELECTEDVALUE ( Table1[Value] )
IN CALCULATETABLE ( VALUES ( Table2[Value] ), ALL ( Dim_Values ) )
), "Only Table1"
)
)

 

 

https://www.dropbox.com/s/r72e077i33gpve9/kesera.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM



Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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