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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kmilarov
Helper II
Helper II

Comparing two date/time columns form two different tables queries

Hi Guys,

I havre two table queries with diffrent data/columns. But both tables have column : date/time . It shows the time when the particular dataste/source file for each query was created. So, the date/time is the same for all rows in the table. But, boht queries /tables have diffrent times.

I want to compare both dates / times and if boht matches - to have parmater/car = 1 if they do not match - to have 0.

 

I tried to create variable :

 

MatchDates =
VAR dat =
SELECTEDVALUE('Util'[Date created])
RETURN
CALCULATE(
    MAX(Limits[Date created]),
    FILTER(ALL(Limits),Limits[Date created]=dat)
)
 
and somehow to filter it but cannot make it. I need lateron to use this match (0 or 1) to add it as a column in hte Limits table (via DAX) in order to filter it
 
Any ideas how to achieve it?

 

 

Screenshot 2024-03-02 093137.pngScreenshot 2024-03-02 093125.png

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@kmilarov Not sure I completely understand but maybe this?

MatchDates = 
  VAR __utilDate = MAX('Util'[Date created])
  VAR __limitsDate = MAX('Limits'[Date created])
  VAR __Result = IF( __utilDate = __limitsDate, 1, 0 )
RETURN
  __Result

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

1 REPLY 1
Greg_Deckler
Super User
Super User

@kmilarov Not sure I completely understand but maybe this?

MatchDates = 
  VAR __utilDate = MAX('Util'[Date created])
  VAR __limitsDate = MAX('Limits'[Date created])
  VAR __Result = IF( __utilDate = __limitsDate, 1, 0 )
RETURN
  __Result

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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