Forum Discussion

kmilarov's avatar
kmilarov
Helper II
2 years ago
Solved

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?

 

 

 

 

  • 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

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    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