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
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


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.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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.